DHCP restart with bulk lease data

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Sep 26 17:05:25 UTC 2019


Surya Teja <suryateja042 at gmail.com> wrote:

> I have an issue with dhcpd service restart when it handles a bulk lease data. As part of testing I have simulated the dhcp server to lease test using dhcperf tool to check the performance statistics when the dhcpserver handles a huge lease data Ex :300689(3M). It is taking 3 to 4 minutes of duration to start up the service, Is this the expected behaviour when we have a such large lease file ? (FYI: No memory, disk space problem on the system)
> 
>  When I restarted dhcpd in the log message I have a seen statement like 
>  Wrote 300689 leases to leases file. 
> Does the restart dhcpd will rewrite the lease file again? 
> I also observed  as new lease file with extension ~ at end like after restart dhcpd
> I see two lease file one with dhcpd.leases and other dhcpd.leases~
>  If it is not expected behaviour can anyone have any reference tool or steps to check what is taking time to bring the service up 

It is a known issue that the server can take some time to start up when there is a large number of potential addresses in the defined pools. The reason for this being the way the server builds hashing tables internally. It is probably to be expected as well in the situation you've described - it must read the leases file and process each lease in turn, updating the internal structures as it goes.

The leases file is a log file database - nothing is ever changed, only new entries added at the end. Obviously, such a file would grow without bounds over time without some sort of cleanup routine. Periodically, default is every hour, the server will write out a fresh leases file from it's internal structures - this file will contain no duplicate entries. It writes this to a new file, moves the existing lease file to a backup name (the one with "~" on the end), and moves the new file into place as the active leases file. The leases file is ONLY read at server startup and never after that - everything is done from in memory structures. In between cleanups as detailed above, every time anything changes, a new record is appended to the on-disk leases file.



More information about the dhcp-users mailing list