Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add rate limit to Redis client #268

Merged
merged 8 commits into from
Oct 29, 2023

Conversation

Garbett1
Copy link
Contributor

@Garbett1 Garbett1 commented Oct 29, 2023

We had some issues with slow downs on workers pulling slowly from Redis.

This PR:
a. Lowers the timeout to 1 second (which is probably reasonable for a Redis command?)
b. Adds a rate limiter in the Redis client that skips the Redis lookups if more than 10 errors have happened in the last 10 seconds.

We only add the rate limit on the read operations, because they are in the critical path.
We want to attempt to keep populating the Redis cache so we can recover to a useful state after the Redis issues.

Not adding configuration just yet, but will make some follow up PRs to add metrics on this.

mettle/worker/redis.go Outdated Show resolved Hide resolved
mettle/worker/redis.go Outdated Show resolved Hide resolved
rexclient/BUILD Show resolved Hide resolved
mettle/worker/redis.go Outdated Show resolved Hide resolved
@Garbett1 Garbett1 merged commit 445f847 into thought-machine:master Oct 29, 2023
5 checks passed
Hamishpk pushed a commit to Hamishpk/please-servers that referenced this pull request Nov 9, 2023
* Add rate limiting bucket to skip Redis if we have errored often

* Puku format

* Add x/time to go.mod

* Add limit in more locations

* Don't mess up the go.mod

* Remove the limit on the write

* Avoid any leak of the digest proto

* Bump version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants