Centrifugo PRO provides a way to configure error limits per connection to deal with this case.Įrror limits are configured as in-memory buckets operating on a per-connection level. Disconnecting abusive or misbehaving connections Ībove we showed how you can define throttling strategies to protect server resources and prevent execution of many commands inside the connection and from certain user.īut there are scenarios when abusive or broken connections may generate a significant load on the server just by calling commands and getting error responses due to throttling or due to other reasons (like malformed command). In this case throttling will simply connect to Redis instances configured for an Engine. The list of operations which can be throttled is similar to the in-memory user command throttling described above. The implementation also uses token bucket algorithm internally. Requests from anonymous users can't be throttled with it. This type of throttling only checks commands coming from authenticated users – i.e. And it's possible to scale Redis in the same ways as for Centrifugo Redis Engine. Our implementation tries to provide good throughput characteristics though – in our tests single Redis instance can handle more than 100k limit check requests per second. Since this throttling goes to Redis to check limits, it adds some latency to a command processing. If one user executed two commands on different Centrifugo nodes, Centrifugo consumes two tokens from the same bucket kept in Redis. In this case limits are global for the entire Centrifugo cluster. The next type of throttling in Centrifugo PRO is a distributed per user ID throttling with Redis as a bucket state storage. The list of operations which can be throttled is similar to the in-memory throttling described above. The difference is that instead of throttling per individual client this type of throttling takes user ID into account. Like per client throttling this one is also very efficient since also uses in-memory token buckets. In-memory per user throttling Īnother type of throttling in Centrifugo PRO is a per user ID in-memory throttling. ![]() Retries of other commands should be handled manually from the client side if needed – though usually you should choose throttling limits in a way that normal users of your app never hit the limits. Refresh and subscription refresh will be also retried automatically by SDK upon errors after in several seconds. error from subscribe command) – subscription request will be retried with a backoff. The same for subscribing to channels (i.e. default - define it if you don't want to configure some command buckets explicitly, default buckets will be used in case command buckets is not configured explicitly.Ĭentrifugo real-time SDKs written in a way that if client receives an error during connect – it will try to reconnect to a server with backoff algorithm.total – define it to limit the total number of commands per interval (all commands sent from client count), these buckets will always be checked if defined, every command from the client always consumes token from total buckets.In addition, Centrifugo allows defining two special buckets containers: The list of operations which can be throttled on a per-connection level is: Our throttling implementation uses token bucket algorithm internally. ![]() inside each individual real-time connection. In-memory throttling is an efficient way to limit number of operations allowed on a per-connection basis – i.e. Centrifugo PRO protection works best in combination with protection on infrastructure level though. With throttling properly configured you can protect your Centrifugo installation to some degree without sophisticated third-party solution. This is useful to protect the system from misusing, detecting and disconnecting abusive or broken (due to the bug in the frontend application) clients which add unwanted load on a server. The throttling feature allows limiting the number of operations each connection or user can issue during a configured time interval.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |