views:

937

answers:

3

I'm working on debugging a slowness issue I've got with running ExpressionEngine (a PHP application) on IIS 7.

I don't think this is actually an issue with ExpressionEngine, but rather an issue with my PHP/MySQL setup.

The problem shows itself thusly:

  1. Go to webite address
  2. IE "spins" for 10-15 seconds, waiting to load. During this time:
    • processor usage is minimal on the server, and PHP's process is inactive
    • I see a connection for the site user in MySQL, but the thread is in "sleeping" more.
    • There is plenty of free memory on the server
    • pretty much, the server is doing nothing
  3. After 10-15 seconds, I see the connection MySQL run some really quick queries (very fast) and the site loads in under a second.

This is a fairly complex site, but it doesn't make any sense that the whole system is just sitting there waiting for 10 seconds - not processing anything. I'm using FastCGI on IIS7, which seems to be working fine, and to me this seems like some sort of a timeout issue where FastCGI, PHP, or maybe even MySQL is waiting for something, not getting it, and after the timeout occurs, continuing to process.

Anyone had similar experiences?

Thanks!

P.S. - I should also add that the database (MySQL) and PHP are running on the same server.

+1  A: 

mysql might be trying to do a reverse DNS on the connection from the web server. if you don't need to filter mysql connections by DNS name, then add skip-name-resolve to your mysql configuration file

longneck
Hmmm....strange - I made that change, and for an instant (1 request) it seemed to have fixed the issue - the site flew right up. But on next attempt to load the site, it was slow again. Perhaps the successful load was just cached. Otherwise, it doesn't seem to have fixed it. :(
Sam Schutte
did you restart the mysql service after you made that change?
longneck
Yes - I restarted it. In my config.php for the application, it's using "localhost" as the server name, and both PHP and MySQL are running on the same server - could this still cause issues with the reverse lookup?
Sam Schutte
is you PHP app trying to do any reverse DNS resolution on the user's IP address? that could also cause the delay if the user does not have a reverse record or if DNS resolution is broken on that box.
longneck
I don't think the app itself is trying to do any reverse DNS, but I don't know for sure, as it's a third party app. I think your suggestion is a good idea though, since the reverse DNS of that particular server is definitely messed up somehow. I just don't know why just upgrading to 5.3 got rid of the problem - I wonder if the PHP library's ability to do reverse DNS on windows changed between 5.2.10 and 5.3?
Sam Schutte
A: 

I have no idea why, but the solution to this was to install PHP 5.3. I had PHP 5.2.10 running, and I guess 5.3 added some extensive optimizations for Windows. Or fixed some other weird problem - who knows.

Actually, after some further digging, it appears the problem was with the Twitter plugin. It waits 25 seconds to come back from Twitter sometime with an error. Maybe this is related to the DNS?

Sam Schutte
+1  A: 

Twitter plugins cause lots of issues in CMS systems. usually there is a function that checks if twitter is there/alive. When twitter gets busy, this slows down the system (thats why it can appear as intermittent) Find the twitter plugin, and the routine that checks if twitter is there. Comment out this code and return true (ie. don't ask twitter if it is there, just assume it is)

Richard Varno