-
Notifications
You must be signed in to change notification settings - Fork 138
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
Rate Limit of Push Consumers for KV Watches #619
Comments
Watchers should be using the ordered consumer which is flow controlled but not rate limited per se, but that could be added since consumers support this. In general I get concerned when seeing rate limiting being used however. |
Also, the original request seem to indicate that the user would want rate-limit for the initial values, so that would need to be clarified. If it is setting the rate limit on the ordered consumer that's one thing, but if the setting has to be removed once the initial values have been received (when the library would normally "post" a NULL entry), then that would require the server to support a consumer update removing the rate-limit (or have to delete and recreate a new one that may not be a good idea). I am not sure if the server supports the rate-limit change during a consumer update. |
It does not, but the ordered consumers flip out ephemerals as normal course when data is missed, so we could use same trick to switch over after initial messages received. |
Hello, KV allow us to centralize this information (no need for file distribution), handle the updates (albeit rare, it happens during the day) and avoid restarting altogether. Having said that, I noticed that there was a rate limit for consumers that's why the original question. Let me add that if you reckon that Nats will protect itself with those "slow consumer" disconnections without impacts then this throttling is no actually needed. thanks! |
This is expressed in bits per second and allow the server to rate limit updates sent to the watcher. This applies to both initial and new updates. Resolves #619 Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This is expressed in bits per second and allow the server to rate limit updates sent to the watcher. This applies to both initial and new updates. Resolves #619 Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
The watchers for the KV should be flow controlled, so before going down the path of rate limits, which can be useful but usually are the wrong solution to a problem, I would like to understand a few things.
|
hello @derekcollison, I'm not able to try the exact same scenario in dev/test but once in production I could run a few tests on weekends. |
I use randomised sleeps at start for this kind of process and it works well to control the impact of a cold start. Success with thousands of subscribers. If you have 5 processes each doing this on one node probably flow control won’t help much but rate limit might. You could also consider 1 process that manages a local cache of the data - so your other processes just reads, for example, a local JSON file and watch it for changes. Thus you get 1/5th of the traffic. Cold start that’s a thundering herd will always be problematic so the real solution isn’t to find a more thundering herd resistant tech but to control the real problem instead |
Randomized sleep is a good idea, we currently restart this way during controlled startup (daily, very early in the morning). |
You should not be seeing any slow consumers since the watchers should be flow controlled. Can you give us more information on the slow consumers you are seeing? |
Hi, I finally have had some time to run a few test. We'll see what happens in production when all our processes restart at the same time and then will decide whether to use RateLimit option. thanks |
@kino71 Hi, I was wondering if you had time to evaluate the PR. If there is no need, I would rather close and not merge it because we don't need to add features that are not proving beneficial. |
Hi, I haven't had much time, but we actually didn't get any "slow consumer" error while restarting simultaneously many instances, I think we might not need this after all. |
@kino71 Thanks for the feedback. Given your answer, I am going to close this issue and the corresponding PR. There is no need to add APIs/configs if we don't see a need at this moment. |
Is it possible to apply RateLimit using nats-c to the underlying push consumer when watching a KV ?
Users would like to throttle the initial reply when watching all.
The text was updated successfully, but these errors were encountered: