Major WordPress blog performance problem solved

In a previous post, WordPress woes, I went through the procedure I used to solve some performance problems related to how the IP address on this server is NATed.  Well, there was another problem somewhere that caused the WordPress admin to be incredibly slow most of the time, caused Akismet to not work at all, and a variety of other symptoms.

I went through a bit of diagnosis, and I came across this in my /var/log/php-errors.log (I enabled this logging in /etc/php.ini to track what was happening):

php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/sitename/scriptname.php on line 20

I checked my /etc/hosts and /etc/resolve.conf and /etc/host.conf files, and everything was fine there.  In addition, DNS resolution worked fine from the command-line via dig and ping.  I tried running my simple test script through the php command-line client, and it worked fine from there.  I checked the script in a browser, and no luck.  It was loading in the browser until the DNS lookup in the script timed out, then it finished loading.

So, I did that again, but this time, I ran

netstat -an

on the command line while the script was attempting its DNS lookup.  It turns out that Apache was looking at an old DNS server, which is not accessible via this network.  Oiy!

This makes a little bit of sense to me, as this server was originally setup in a convenient location on a different network, and then physically moved the server to the colocation data center.

Well, I don’t know why Apache still thought it should look at the old DNS server (the one from the other network) but I made sure there was no reference to it in old /var/lib/dhclient.leases files and then ran

apachectl stop
apachectl start

And, viola! The problem went away!  All the other times, I just ran

apachectl graceful

which apparently wasn’t clearing out it’s memory of the old DNS server, or it was still looking at the (not currently relevant) dhclient lease file, which is silly, since I now have the server setup on networks with dedicated IPs, and I am not using dhcp on any interface.

Weird.  But, solved!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.