The Hot Rod protocol current passes the size of the hash space used to clients, so that
clients are able to create a consistent hash and perform smart routing.
https://docs.jboss.org/author/display/ISPN/Hot+Rod+Protocol+-+Version+1.0...
https://docs.jboss.org/author/display/ISPN/Hot+Rod+Protocol+-+Version+1.2...
However there are no rules as to what this hash space is, and this forces clients to use
the remainder operation when performing modular arithmetic. This has been proven to be
inefficient [1] [2] [3], and can be greatly improved if we made a simple assumption that
the hash space will always be a power of two.
Perhaps something we can add in v1.3 of the protocol, so that clients talking to a server
using Hot Rod 1.3 can make the assumption that the hash space is a power of 2?
WDYT?
- Manik
[1]
http://dhruba.name/2011/07/12/performance-pattern-modulo-and-powers-of-two/
[2]
http://scicomp.stackexchange.com/questions/187/why-is-division-so-much-mo...
[3]
http://disruptor.googlecode.com/files/Disruptor-1.0.pdf (Page 5, last paragraph)