I'm implementing a throttling mechanism to limit the amount of web requests sent to a server. If there are too many submissions for a request then the extra requests are queued until the resource becomes available. There seems to be many throttling options and im not sure which one to choose.
So far im tempted to implement the token bucket algorithm as described at http://en.wikipedia.org/wiki/Token_bucket . There is Python code associated with this at What's a good rate limiting algorithm? so should be straightforward to implement a Java/Scala version.
Guava has what looks like a nice implementation described at http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/RateLimiter.html
Also Akka seems to implement throttling using the Throttler trait described at : http://doc.akka.io/api/akka/2.1.2/index.html#akka.contrib.throttle.Throttler
I would like to implement my own but don't like re-inventing the wheel if there is a solution already available. Are there advantages to using the token bucket algorithm over using the options already provided by Guava & Scala ?
Out of the three options which is most recommended ?