I would approach this protocol. Throttle when it requires actual maintenance, not when you think it will happen. Instead of worrying about how many callbacks the reactor ticker is waiting for, I’ll worry about how long the HTTP requests take (for example). The number of operations awaiting the reactor may be implementation details - for example, if one access pattern ends with callbacks on long lists of pending lists, and the other has a more linear chain of callbacks, the response time may not differ, although the number of callbacks will be.
This can be done by storing the time metric to complete the logical operation (for example, serving an HTTP request). The advantage of this is that it gives you important information before a problem occurs.
source share