Linux – PHP & MySQL combo is running insanely slow on Windows Server 2008

apache-2.2linuxMySQLPHPwindows

I wrote some PHP and MySQL scripts on a Linux (Debian) box a while back (Running on LAMPP). Pages that requested some 2000 MySQL rows executed and returned data in roughly 0.001 seconds, and looping scripts (Multi-threaded) that updated this MySQL table ran in the background, using approximately 10 seconds per loop.

We just upgraded our box (All new PC), getting four times the RAM and a greater clock speed on the CPU. This box has Windows Server 2008 installed (And XAMPP). The exact same scripts that ran on the Linux box now runs on the Windows box, but:

  • The pages that fetch info from MySQL spends 5-10 seconds to return data
  • The loop that spent 10 seconds on the Linux box now uses 60-80 seconds
  • The loop freezes (Or uses over 30 minutes per loop) if Apache is running

What on earth is going on? Is there a known issue with PHP and MySQL running on Windows? If not, how would I go about figuring out why every small command is pumping the CPU at 100% for seconds now, when they finished in 0.001 seconds on the lesser specced Linux box without bothering the CPU?

Mostly I'd like to know; do we have Windows to blame or the new box? (If we installed Linux on the new box, what'd be the result?)

Best Answer

Turned out it was just the greater overhead of running Windows Server plus all the CMDs that were opened per PHP process. Installing Debian on the box got everything running smoothly again.