Synchronous Disk Writes and DHCP Performance Limitations
  • 03 Oct 2018
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Synchronous Disk Writes and DHCP Performance Limitations

  • Dark
    Light
  • PDF

Article Summary

Problem:

DHCP performance can be limited by disk I/O. Every lease issued by the DHCP server (every DHCP ACK) incurs a write to the dhcpd.leases file. Messages sent to syslog are generally written at some point to a system log file. Modern I/O devices vary considerably in their performance characteristics but in general writes to a file system stored on a traditional hard disk are extremely slow compared to other operations performed by the server and may create a bottleneck which will affect your DHCP server's performance.

Solutions:

Here are some tips to help you speed performance on an I/O-bound server:

  • Although every lease needs to be written to disk, you may be able to realize performance increases by changing the configuration parameters for"delayed-ack" and "max-ack-delay", causing the DHCP server to batch-write leases to disk, eliminating costly fsyncs.
  • If you have the option to do so, moving the leases file to an SSD or other high-performance, low-latency storage system can dramatically speed lease writes and reduce blocking.
  • If you are using DDNS in conjunction with DHCP, you may see better performance using ISC dhcpd 4.2 or later, as dynamic DNS updates are performed asynchronously starting in 4.2.
  • Be aware that not all versions of syslog behave identically. In particular some (not all) Linux implementations (and possibly on other OS platforms as well) default to synchronous writes. If your default syslog is causing you problems there are many alternative open software versions available with which you can replace it.

If you are still experiencing I/O limitations after trying the previous suggestions, other approaches you can take to achieve greater performance include adjusting the lease time upwards to reduce the frequency of renewals and configuring parallel servers and dividing the address space served by them into separate pools.

RAM disk storage not recommended for dhcp leases file
Although you can get near-instantaneous write performance by putting the dhcpd.leases file on a RAM disk based filesystem, we do not recommend storing the leases file on a volatile file system because of the problems that can be caused if it is lost. If you choose to store the leases file on a RAM disk, be careful to back it up frequently to mitigate the risk of sudden data loss.

Optionally disabling synchronous writes
There is a configuration option in versions of ISC DHCP 4.3.0 and higher named "dont-use-fsync". Declaring this option in your dhcpd.conf file will tell the server to skip synchronizing writes after updating the lease database. ISC does not recommend using this option to increase performance unless you know what you are doing and have other measures in place to preserve lease file consistency -- use of this option increases the chance that if the server is suddenly interrupted the lease file will end in an inconsistent state.