apache, php, mysql slow under windows 8. how to fix.

2012-12-24

I recently escaped from Apple based computers to go back to normal laptops. I purchased a very powerful Lenovo ThinkPad W530. It is a war machine. I am so happy and satisfied with it that I will even keep Windows 8 Professional for a while. I will then switch back to my beloved GNU/Linux as well. Meanwhile, I still have to accomplish many development task, some of which are classic web development (read: PHP, MySQL, and Apache).

There are so many WAMP solutions for Windows 7 (e.g., WampServer, Bitnami stacks, and EasyPHP). While many of them will work on Windows 8 without issues, XAMPP is Windows 8-ready.

Unfortunately, I encountered a widely reported issue. Apache PHP, MySQL are slow under Windows.. Terribly slow. Sometimes, even slower than deployed websites on the Internet. I had to wait from 3 to 10 seconds just to load a local Wordpress website.

In this short post, I summarize all the proposed fixes and report which one really solved my problem. The following are only a small part of the proposed fixes to solve WAMP slowness under Windows 7 and Windows 8:

  1. Exclude Apache, PHP, and MySQL from your Firewall checks.

  2. Add Apache, PHP, and MySQL executables, and the Website Folders as exceptions of your Antivirus.

  3. Make sure you are loading PHP as an Apache module rather than using CGI methods.

  4. Tune php.ini.

  5. Disable xdebug extension.

  6. Disable IPv6.

  7. Make sure that Apache only listen to IPv4 as well.

  8. Setup a proper hosts file: disable IPv6 localhost, enable the IPv4 localhost counterpart, and make sure to do the same for all your VirtualHosts, if any.

  9. Employ Voodoo-like tunnelling systems.

I did all of them without any reasonable improvement. Sure, they might all help after applying the only fix which worked for me.

Do you want to know what really fixed the issue for me? Promise you will not laugh.

I mostly worked on GNU/Linux in the last 10 years. Somehow, I employed OS X as well. Unfortunately, I am not a Windows power user. I don’t seriously use Windows since XP.

Today, I discovered that there is a serious difference between the “Balanced” and the “High Performance” power plans of Windows. This difference is still strong when not using the battery (that is, power cable plugged). While GNU/Linux and OS X somehow unleash the beasts living in our laptops when the power cable is plugged, Windows on my Lenovo did not. It still was limiting CPU scaling capabilities and keeping it as much low as possible.

Either switching to “High Performance” power plan or customizing the “Balanced” plan settings solved the issue for me. In particular, I think that bringing the “Minimum Processor State” option from 5% to 80% does the trick. You can bring it to 100% if it doesn’t make your laptop lift-off. Additionally, I (finally!) stopped complaining how Windows 8 was still slow when opening Google Chrome, IntelliJ Idea, or the File Explorer itself despite using a SSD drive. Comparing to GNU/Linux, the difference was huge. Now it is no more.

I feel a little dumb. However, we never stop learning and I am happy to share this experience.


I do not use a commenting system anymore, but I would be glad to read your comments and feedback. Feel free to contact me.