arodland / smockron

Distributed HTTP rate limiting for nginx and node.js using ZeroMQ and redis
http://arodland.github.io/smockron/
40 stars 5 forks source link

Limit the number of DELAY_UNTIL messages we send #4

Open arodland opened 10 years ago

arodland commented 10 years ago

If the server receives a bunch of DELAYED accounting messages for a client after it has already published a DELAY_UNTIL command for that client, it will send a new DELAY_UNTIL for every accounting message it receives, pushing the delayTS out further and further. This is unnecessary, and possibly a minor sort of DoS vector.

We could delay the publishing of a new DELAY_UNTIL until the current one is close to expiry, and only publish one message at that time, even if more than one accounting message arrived in the meanwhile (the timestamp we publish should be the greatest of all of the timestamps that would have been published). This would reduce the amount of "broadcast traffic" the system would generate.

Downsides are that it requires keeping more server-side state.