Fixed: Slow WordPress performance on IIS 7

I ran into a slow performance issue running a WordPress site under IIS 7. I was in a hurry to get the site up and running, and used Microsoft’s Web Platform Installer to get the site set up. Everything worked right away, but every page took at least a half second to respond. After some digging around, I found another site that explained what the issue was.

The default configuration is to point PHP’s MySQL driver to “localhost”. This causes the MySQL driver to loop through all possible IP addresses for that hostname until one connects. In my case, the Windows 2008 box I was on had an IPv4 and an IPv6 address. Windows 2008 favors IPv6 by default, so PHP attempts to connect to the local IPv6 address first, waits to timeout, then connects to the IPv4 address where MySQL is listening.

The easy fix: point PHP’s MySQL connection to “127.0.0.1” on Windows to avoid this slow issue. Now the pages load almost instantly.


Posted

in

by

Tags:

Comments

One response to “Fixed: Slow WordPress performance on IIS 7”

  1. moff Avatar
    moff

    Great post. Really improved my site performance. Thanks!

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.