Server startup slow under BSD with many interfaces
name: dhcpd startup is terribly slow under BSD with hundreds or thousands of interfaces
about: the startup is slow because getifaddrs() is walked for all interfaces O(n^2)
Describe the bug When running dhcpd under FreeBSD, bpf.c relies on getifaddrs() to determine the MAC address of each interface. getifaddrs() ends up being iterated entirely for each interface, yielding O(n^2) performance. This is not that big of a deal until you have hundreds or thousands of interfaces (e.g. VLANs) and the restart takes too long (30seconds) for a production network.
To Reproduce Steps to reproduce the behavior:
- Run dhcpd on thousands of interfaces
Expected behavior The startup time is very slow until the daemon responds on BPFs
Environment:
-
ISC DHCP version: 4.4.2
-
OS: FreeBSD 12.1 from FBSD ports
-
Standard net/isc-dhcp44-server port
Edited by Nick Rogers