RDO Servers
New member
- Joined
- Apr 3, 2015
- Messages
- 770
- Points
- 0
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!
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!