Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

a large /etc/hosts file causes problems with "DirectoryServices" 800% CPU

Recently i've been noticing that DirectoryServices takes 800% CPU on my 8 core Mac Pro. Issue is very easily reproduced when doing subnet scans with ARD or looking at google maps pages on Safari. After much troubleshooting I discovered the culprit:

My /etc/hosts file

I use the entries provided by http://www.mvps.org/winhelp2002/hosts.txt to block advertising sites. The entries make the hosts file 16528 lines long. So the problem is related to the amount of lines entered into the /etc/hosts file. This is a big problem for me as the workaround is to remove the entries from the file.

lots of different macs, Mac OS 8.6 or Earlier, macs!

Posted on Oct 24, 2009 5:30 AM

Reply
2 replies

Nov 7, 2009 3:08 AM in response to matuzalem

So... I've a similar problem. I also have downloaded a very long host file to block all the adds, just to browse a cleaner web 😉

The problem is... my hosts file as 89746 lines :P and... When I try yo use it, it really cleans up the web, the problem is... the navigation is slow! :P

When I open a website without any ads to block it works fine... but when I open a website with some adds to block it just took a looong loong time to load the page... so what's the problem?

BTW my hosts file is redirection everything to 127.0.0.1.

Here is an example of my file:
[quote]
127.0.0.1 ad.directaclick.com
127.0.0.1 adservices.google.com
127.0.0.1 adwords.google.com
127.0.0.1 desktop.google.com
127.0.0.1 domains.googlesyndication.com
127.0.0.1 gacollector.l.google.com
127.0.0.1 gadgetads.googlecode.com
127.0.0.1 gmodules.com
[/quote]

😉 Thanks

Nov 7, 2009 6:06 AM in response to iTCB13

I had seen a similar post and noticed the same issue.
I stripped out the long hosts file and just started adding the things that were really annoying to me.
When I came to a website that had one of those items, I right-click and Inspect Element to determine what the address was. I then added that address to my hosts file.

You may need to Show Develop menu using the Advanced Safari Prefs to get the Inspect Element. You could also view the raw source, but that takes a while to narrow down to the code.

I don't mind adds, but if they bounce, flash, or put links in the middle of the text, I block them.

a large /etc/hosts file causes problems with "DirectoryServices" 800% CPU

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.