• warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.

Late nights with IIS (or why I'll stick with Apache)

I just recently ported a php application for a company from a Linux box to a Windows server running iis, and have been struggling all week with performance problems on the site. So after much digging around newsgroups I finally found why the new server is being so slow. It really boiled down to two things:

1. IIS makes sql do a dns lookup for every query involving any users created for localhost. This really slows down individual calls to the database, but can be fixed by changing the location of each user from 'localhost' to 127.0.0.1 and adding "skip-name-resolve" to the mysql configuration file (usually called my.ini in the mysql install directory on windows ). I also enabled a few other good things like database caching and other similar goodies that are always good for fixing mysql performance issues.

Unfortunately even after these changes performance was better  but still painfully slow compared to what we were getting on our crappy old linux box which was only a fraction as powerfull as the new windows server, so that meant I had to keep digging and finally found this:

2.http://www.phpbuilder.com/board/showthread.php?t=10257783, apparently by default on iis, it likes to deliver the html page in chunks from the php engine to the iis output engine, what this does is for a page that calls mysql multiple times, it opens and closes the database connection for each of those chunks of the page it processes, which is a very costly operation. This can be fixed by setting the php directive "output_buffer = on" which tells iis not to render the page untill all the php scripts on the page have completed running, the difference in performance was amazing. it cut down the load time of on particularly mysql heavy page from 20+ seconds to just under 3 seconds .

So finally performance is cleaned up, but I don't think I'll be mixing and matching iis and php again, I still have a huge list of upgrade problems and doing quick google searches on them all seem to return "On a windows server you need to change this default setting because IIS handles it the wrong way...."

 

Ahhh....Apache..... welcome back my old friend, I'll never stray from you again :)

Trackback URL for this post:

http://softwarebyrichard.com/trackback/45
Your rating: None Average: 2.6 (7 votes)

Comments

And just a follow up on this,

And just a follow up on this, apparently if you use the output buffer for the eitire page, calling posts from a ajax call will crash the iis service.

 

and the php function mysql_escape_string in iis also seemed to have the nice feature of instead of cleaning the string, it would empty it out, setting my variables to blank.

 

What amazing new feature of iis will I find tomorrow :(