[OpenAFS-devel] rx peer hashing sucks.

Ted Anderson TedAnderson@mindspring.com
Mon, 20 Sep 2004 10:38:48 -0400


On 9/20/2004 00:33, Nickolai Zeldovich wrote:
> I would suggest tossing rx_hashTableMask altogether, and changing the
> value of rx_hashTableSize to a nice prime number, like 257.  Then the
> hash function can be as simple as:
> 
>   #define PEER_HASH(host, port)   ((host ^ port) % rx_hashTableSize)

I'd suggest using the afs_lhash code in src/util/afs_lhash.[ch].

Failing that, I'd used a much better hash function to combine host and 
port.  The one specified by Bob Jenkins[1] is good enough to eliminate 
the need for a modulus and is quite fast.

Ted

[1] http://burtleburtle.net/bob/hash/index.html#lookup