Anonying dns.exe high memory consumption

In Windows Server 2008 R2 or older OS with MS08-037 patch installed, DNS server (dns.exe) consumes ridiculously large amount of precious memory.

Under the hood, dns.exe opens more than 5000 UDP ports during start up, 2500 for UDP IPv4, 2500 for UDP IPv6.  Large amount of kernel memory is also allocated for these ports.  This can get even worse when increasing the number of CPU cores on the system.  200MB consumption on a 4 cores system is fairly common.  wtf!!

One of the workaround is to reduce the value one called SocketPoolSize, which may potentially increase the security attack surface.  The default value for SocketPoolSize is 2500.  Set to 10 may be good for lightweight DNS server used behind the firewall.

Following command can read/set the value

Dnscmd /Info /SocketPoolSize

Dnscmd /Config /SocketPoolSize 10

After restart the DNS service, the memory consumption goes down to an acceptable 10MB range.

This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Anonying dns.exe high memory consumption

  1. Pressley says:

    I’m having the same issue. Has Microsoft indicated this is a known bug and attempting a fix?

  2. Tonyc says:

    Worked, thank you for this!!!

  3. Juan says:

    Thank you.
    In addition to lowering the SocketPoolSize from 2500 to 1000, I also disabled IPv6 on my network interface.
    My DNS Server RAM usage went from 152 MB to 33 MB.
    This is on a Windows Server 2012 VM running on Hyper-V, with 4 virtual processors and 4 GB RAM.

  4. 2012 Guy says:

    This works really well
    It is still broken in Windows 2012

  5. Felipe Donda says:

    Trying this with edns disabled and IPv6 disabled, I just need the client to reboot the machine. Thanks for the help =)

Leave a comment