Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?)

share|improve this question
    
possible duplicate of serverfault.com/questions/208039/… –  Grzegorz Szpetkowski May 19 '11 at 15:26
add comment

3 Answers

You could install sql express and see if the problem is mysql on windows (i know of no issues but maybe you have an outdated version?). Windows in and of itself isn't going to be the issue. PHP should run no problem under IIS (see the Running PHP Applications on IIS page for details. If straight mysql queries run as fast (well reasonably close as mysql isn't going to be that fast) as sql server then the next thing to check is apache. The only real problem I've come across with that is that it gets configured like a *nix copy of apache - which can certainly kill performance.

share|improve this answer
add comment
up vote 0 down vote accepted

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.

share|improve this answer
add comment

That's a problem when you have IPv6 enabled. Using localhost on the server name (very common) causes connections to take too long to stablish. Changing it to 127.0.0.1.

Since you have a loop, if you close and re-stablish connections it will multiply the slowdown, and making the connection fast will make a huge difference.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.