tuning for maximum dhcp performance

Frank Bulk - iNAME frnkblk at iname.com
Fri May 9 02:18:25 UTC 2008


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?

Frank

-----Original Message-----
From: dhcp-users-bounce at isc.org [mailto:dhcp-users-bounce at isc.org] On Behalf
Of David W. Hankins
Sent: Tuesday, May 06, 2008 4:08 PM
To: dhcp-users at isc.org
Subject: Re: tuning for maximum dhcp performance

On Tue, May 06, 2008 at 11:49:46AM -0700, Brad Dameron wrote:
> Local6.*                                      -/var/log/dhcpd.log

this actually stops it from fsync'ing after every write, which
competes with dhcpd if it's on the same spindle as dhcpd.leases.

> In the includes/dhcpd.h file find LEASE_HASH_SIZE. Change it from 100003
> to 250007.

in 3.0.x, everything had the same default hash size called
DEFAULT_HASH_SIZE in includes/omapip/hash.h, and defaulted to
something rediculously small (9973) for leases which was rediculously
large for everything else.

in 3.1.x, we adjusted a lot of the hash tables (some down that were
rediculously oversized, some up...lease hash went up) so the defaults
were less rediculous.  one of our design constraints was making sure
we kept a "zero sum" - so 'dhcpd' with an empty config didn't change
very much in size (if at all).  we basically used all the free space
from downsizing some tables to upscale others.

at some point in some future revision, we'll make the tables scale
themselves upwards as needed (size and allocate the tables after
loading config, then put all the leases in them).

but for now you want to pick a number that is larger than the number
of dynamic leases in the database, and preferrably also prime (it
reduces an overlap condition if you use disjoint subnets (e.g. from
different NIC allocations)).

you can google for a list of prime numbers.


i also have some ideas to improve the string ("option name hash") and
data ("client id / hardware address hash") hash-key generator
functions, as there are still some collisions in the default hash
tables that i couldn't smooth out by playing with table sizes.

--
Ash bugud-gul durbatuluk agh burzum-ishi krimpatul.
Why settle for the lesser evil?  https://secure.isc.org/store/t-shirt/
--
David W. Hankins        "If you don't do it right the first time,
Software Engineer                    you'll just have to do it again."
Internet Systems Consortium, Inc.               -- Jack T. Hankins




More information about the dhcp-users mailing list