tuning for maximum dhcp performance

Andy Hood ahood at au1.ibm.com
Mon May 12 03:19:03 UTC 2008


dhcp-users-bounce at isc.org wrote on 10/05/2008 04:40:26 AM:

> > On Thu, May 08, 2008 at 09:18:25PM -0500, Frank Bulk - iNAME wrote:
> >> This may be a dumb question, but why not calculate an optimal hash
> >> size at
> >> the first start, update it and store it in the dhcpd.leases file
> >> while the
> >> dhcpd process runs, and then read it from the dhcpd.leases file and
> >> use it
> >> every time the process starts up?
>
> On May 9, 2008, at 12:20 PM, David W. Hankins wrote:
> > we should totally do that;
> > ...
> > no need to store it in dhcpd.leases.  we can count the number of
> > leases in config after loading dhcpd.conf but before processing
> > dhcpd.leases (just keep a list of all the requested dynamic ranges),
> > allocate a hash table of a specific size, and "instantiate" the raw
> > config into the optimally-sized table, then process the lease db
> > normally.
>
> Hm, such as incorporating a list of suitable primes included in the
> source to
> be used with various ranges of lease counts?  Sounds useful.
>
> Short of that, how about a config option, one to declare the size of
> the hash
> table, and/or one to give a rough estimate of the number of leases
> there are going
> to be?  But if the coding to implement such options requires as much
> relocating of code/function
> as allocating for the hash table after the leases are counted, then
> this idea would hardly
> be worth the trouble.  Might as well just count leases.

Calculating primes is pretty quick. At least for numbers up to 2^32.

Given the 6542 primes < 2^16 it takes < 0.1 second to find the first prime
greater than any given number below 2^32 on my pre 2000 AIX box.

Did you intend using the same hash algorithm for IPv6 addresses? There are
82025 primes below 2^20 which lets my algorithm work up to 2^40.

Regards,
Andrew J Hood

RIP: Robert Jordan (James Oliver Rigney, Jr.) (Oct 17, 1948 – Sep 16, 2007)


More information about the dhcp-users mailing list