Nextdoor / ndserviceregistry

Nextdoor ServiceRegistry Foundational Python Class
27 stars 12 forks source link

Throttling should only be activated in the case of too many pending requests #62

Open skrawcz opened 9 years ago

skrawcz commented 9 years ago

The current throttling mechanism is primitive; it artificially limits throughput even though ZK might be perfectly find to handle and respond to the requests.

E.g. default throttling setting is 50 calls in 2 seconds. You could easily construct the scenario where ZK returns all the calls in 1 second, and that means any subsequent calls will sleep for 1 second before hitting ZK, even though ZK is idle.

A better solution that would work without having to fine tune the throttling setting, would be to throttle when the number of pending requests is growing faster than they can be served by ZK.

diranged commented 9 years ago

@skrawcz, I completely agree that the throttling mechanism is primitive. I'm not sure how to implement your suggestion -- do you think you could hack something up to see?