trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Kuzemko <tom...@kuzemko.net>
Subject Re: RamCacheCLFUS
Date Mon, 18 Feb 2013 21:41:58 GMT
Did not look at the code, but seems like it is part of some general hash 
table implementation.

Good explanation why these are primes:

http://stackoverflow.com/questions/1145217/why-should-hash-functions-use-a-prime-number-modulus

Best regards,
Tomasz Kuzemko
tomasz@kuzemko.net

W dniu 18.02.2013 20:50, Phil Sorber pisze:
> In looking through RamCacheCLFUS I came upon this:
>
> static const int bucket_sizes[] = {
>    127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071,
> 262139,
>    524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
>    134217689, 268435399, 536870909, 1073741789, 2147483647
> };
>
> Looking through git blame and JIRA it looks like it was part of the initial
> patch for CLFUS. In talking with James in IRC he pointed out that it looks
> like the largest prime less than a power of 2. This seems like a very
> deliberate choice, but I can't figure out why and there are no docs
> explaining. Can someone, perhaps John, shed some light on it?
>
> Thanks.
>

Mime
View raw message