I'm currently using a blacklist off https://github.com/StevenBlack/hosts, which has 50,000+ domains. However, I'm finding that my DNS Client CPU usage is abnormally high.

Does a large hosts file cause high CPU usage?

If so, apart from browser plugins, what are some alternatives to using a hosts file to blacklist certain domains across the whole system?

Edit: Windows 10

  • Is this windows or linux? Linux has ipset inconjection with iptables. My list is 600,000+ long and growing.
    – cybernard
    Commented Apr 29, 2018 at 5:44
  • 2
    remove the large hosts file and see if works normally again.
    – Keltari
    Commented Apr 29, 2018 at 5:46
  • @Keltari Yes CPU usage goes down when removed. Commented Apr 29, 2018 at 6:48
  • Confirm with the large hosts file. The Windows boot sequence waits for this to complete, so hourglass on the taskbar, and internet availability in question for some apps, although starting the browser to check this page was fine. Never had much luck in removing or editing the hosts file while it is in use, so the best option is just to wait until DNS Client has processed the urls. Commented Mar 16, 2023 at 14:14

3 Answers 3


This issue can be successfully resolved via regedit by removing 'DNSCache' entry from NetworkService REG_MULTI_SZ at:

  1. HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost

  2. HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Svchost

Prior to this I had to wait ~10 minutes for SVCHOST DNS Client to complete its process when using Steven Black's hosts file. After making this change, I no longer have to wait. Enjoy....


Disabling DNS Client service is not a good idea because many software like WireGuard and Hyper-V Default Switch depend on it. Another way is to limit its CPU usage and set its priority.

Here is a PowerShell script which makes DNS Cache service only run on CPU3 and have the lowest process priority.

#Requires -RunAsAdministrator

$svcPid = Get-WMIObject Win32_service | where Started -eq "True" | where Name -eq "DnsCache" | select ProcessId
$process = Get-Process -Id $svcPid.ProcessId
$process.ProcessorAffinity = 8

where 8 is a bitmask of CPU IDs (Documents here).

You can execute this script every time system starts.

powershell.exe -NonInteractive -NoLogo -NoProfile -File "C:\...\LimitDnsCacheCpuUsage.ps1"

Note: This method requires Service Host grouping has been disabled. Fortunately, service Host grouping is disabled by default on machines with more than 3.5GB RAM.


disable (stop) DNS client, you do not need it in Windows

you may have also high CPU with large hosts with disabled DNS service, caused by explorer.exe (probable related to some antivirus)

  • Access was denied in attempting to stop the service. Did actually manage to end the DNS Client task (the options were to restart system or cancel), but up popped a message about the system being unstable. The task did restart automatically, however, which affirms that Windows recommends to leave the DNS cache alone. Commented Mar 16, 2023 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .