RDO Servers

Well-known member
Registered
Joined
Apr 3, 2015
Messages
1,027
Points
83
Hey everyone,

I figured I would share something we recently learned about getting the best performance out of MySQL and IIS. We recently put up a test Wordpress site. One copy of it on our site, one copy on Amazon Elastic Compute Cloud (EC2). After running some speed tests, we realized our's was consistently 1 - 1.5 seconds slower then the instance on EC2. The delay was coming from "wait" time, or the 'time to first byte' (TTFB).

Come to find out, MySQL does not like IPv6. You can set MySQL to resolve IPv6 addresses, but by default, it will not work with the mysqlnd driver.

What does this mean for your site?

If you have MySql connection strings in your php application set to "localhost", IIS will return a IPv6 loopback address.
MySql will think it is a hostname or string, rather then a IP.
Your application will have to timeout, then try again once it falls back to the IPv4 address.

How do you fix it?

If you are running a VPS or dedicated server, you can disable IPv6 support, or set a preference for IPv4 over IPv6. If your like most people and using a shared hosting server, then this type of server wide change is not an option for you!

But, you can still fix the problem quite easily! Rather then using "localhost" in your connection string, use the actual IPv4 loopback IP: "127.0.0.1"
With this simple change, our wordpress site was loading in milliseconds, rather than seconds!

I hope this info helped someone, or at least someone learned a little something!
 

elcidofaguy

Well-known member
Registered
Joined
Jan 13, 2015
Messages
866
Points
0
Nice one! Always great to know of such tips which can improve performance... Curious to know if this or something similar applies to apache server also... Cheers!
 
Newer Threads
Replies
9
Views
3,772
Replies
9
Views
3,040
Replies
1
Views
2,200
Replies
9
Views
4,240

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top