High ram-usage with multiple /16 ipv4 networks

Peter Rathlev peter at rathlev.dk
Mon Apr 20 16:48:12 UTC 2015

Hmm... I'm not sure I understand the configuration:

On Mon, 2015-04-20 at 17:14 +0200, Ruben Wisniewski wrote:
> subnet netmask {
>     range; #main
>     pool {
>         range;
>         deny all clients;
>     }
>     pool {
>         range;
>         deny all clients;
>     }

Wouldn't the "deny all clients" statements make those ranges a no-op? So
each subnet has just 2558 available leases? But maybe this is just

Otherwise it seems to fit with what we see on our servers. I'm guessing
the ranges that deny all clients still create leases. That gives you
62714 leases per subnet (2558 + 2558 + 57598) and 1567850 leases for 25
of those.

Our dhcpd process currently uses around 360 MBytes on each of the two
servers in a failover configuration in total. We have about 750k leases:

  dump-complete-dhcpd-config \
  | sed -e 's/.*range //; t PRINT; d; :PRINT s/[[:space:]]*;.*//;' \
  | while read LINE ; do \
      set -- $LINE
      echo $(( 0x$( gethostip -x $2 ) - 0x$( gethostip -x $1 ) ))
  done \
  | awk '{ SUM += $1 } END { print "Total number of leases: "SUM; }'
  Total number of leases: 752066

> The ram-consumption is the same when the daemon is starting with an
> empty lease-file. And is constantly increasing on runtime:
> http://i.imgur.com/60QgMe2.png

What part is it that you see constantly increasing in that graph? I see
the swap doing something that looks like an asymptotic increase towards
some number around 1 GBytes or thereabout. Similar for "committed",
whatever that is in this context.

Is this a failover setup? The configuration doesn't say that, but in a
failover setup the servers always create all leases from the beginning.
The only thing that make the memory usage grow is whatever extra
information is added to the leases, and there might even already be
memory reserved for some of that in advance.

I don't know if a non-failover configured server reserves memory for all
leases up front, I haven't run anything with a large pool of addresses
without failover.
> So my question is, it this much ram-consumtion expected or a bug? 

I'd say it looks normal. Running a DHCP server for 1.5 million leases is
no small feat. Running a server at all with just 512 MBytes of RAM
sounds like asking for trouble anyway. (RAM inflation, I know, but RAM
is cheap these days.)


More information about the dhcp-users mailing list