Please take a moment to read http://bit.ly/demandglobalchange, to help share the message and support the initiative to tell our leaders to focus on addressing the global world problems, instead of complaining about the effects of their lack of leadership. Be a leader yourself, and share this with as many people as possible. #demandglobalchange // https://www.facebook.com/demandglobalchange

Please consider donating: https://www.corelan.be/index.php/donate/


4,266 views | This page as PDF

PHP performance on Windows 2008/IIS7

My discussion forum has been running for more than a month now, and I guessed it was about time to have a look at the performance of the web site.

The forum is based on bbPress, uses PHP 5.2.x and runs on a MySQL back end.  In my configuration, the entire setup is running on a Windows 2008 server with IIS7.

While the forum in itself runs fine, I noticed that the performance was really bad.  Loading even a simple page appeared to take ages.
I used the bbpress benchmark plugin to measure performance.

Result : 5 seconds were needed to load a simple page, and that is unacceptable. 

As you can see on my forum (http://forums.corelan.be:8800), the speed is much better now.  How did I solve this ?

First, let’s have a look at the original benchmark results :

total page time: 5.3 seconds.
time to render page: 5.2715 seconds (query time subtracted)
total query count: 58
total query time: 0.0285 seconds

slowest call was # 8 : 0.0038 seconds

time to reach each section:
bb_underscore_plugins_loaded = 0.172
bb_plugins_loaded = 5.210
bb_init = 5.211
bb_index.php_pre_db = 5.215
front-page.php = 5.217
header.php = 5.220
logged-in.php = 5.247
footer.php = 5.298

So apparently it has nothing to do with the MySQL server.  The server performed 58 queries in a total of 0.0285 seconds, which is not that bad.
The time between loading the bb_underscore_plugins and the bb_plugins was not ok : it took 5 seconds just to load the other plugins.
So maybe there was something wrong with one the plugins.

I disabled a couple of less important plugins, but it still took 5 seconds to load the page. Of course, I could disable all plugins, but I was trying to avoid this for now. I could still go back to the plugins if nothing else works.

So I decided this could be a system issue. (PHP, IIS)

With regards to IIS : I have a couple of other websites running on the same IIS server, with good performance. A performance monitor does not indicate other problems with the server.
So I could rule out the IIS component.

PHP was installed and tweaked for security. But when I opened php.ini again, I found some obvious performance related settings that were not modified.

I made the following changes :

register_long_arrays=off
output_buffering=4096
variables_order = "GPCS"

and I disabled

engine=on

saved & closed the file, and now the forum runs much faster :

New benchmark results :

total page time: 0.3 seconds.

time to reach each section:
   bb_underscore_plugins_loaded =  0.180
   bb_plugins_loaded =  0.203
   bb_init =  0.203
   bb_index.php_pre_db =  0.207
   front-page.php =  0.209
   header.php =  0.212
   logged-in.php =  0.238
   footer.php =  0.298

time to render page: 0.2715 seconds (query time subtracted)

total query count: 58

total query time: 0.0285 seconds

 

As a sidenote : it is a good idea to activate php logging.  When errors occur in your php scripts, they will get logged. These errors could indicate performance issues. Even if an error looks like to be a minor issue, it could potentially have huge impact on the performance.

© 2008 – 2015, Corelan Team (corelanc0d3r). All rights reserved.

Related Posts:

One Response to PHP performance on Windows 2008/IIS7

Demand Global Change

The world needs your help !

Please take a few moments to read the "Demand Global Change Call For Action" document at
http://bit.ly/demandglobalchange
Read the full document at
http://bit.ly/demandglobalchange_full and share the message with as many people as possible.

Like the Facebook page, and SHARE it with everyone you know.



Donate

Want to support the Corelan Team community ? Click here to go to our donations page.

Want to donate BTC to Corelan Team?



Your donation will help funding server hosting.

Protected by Copyscape Web Plagiarism Tool

Corelan Team Merchandise

You can support Corelan Team by donating or purchasing items from the official Corelan Team merchandising store.

Corelan Live training

Since 2011, Corelan GCV has been teaching live win32 exploit dev classes at various security cons and private companies & organizations.

You can read more about the training and schedules here

Corelan on IRC

You can chat with us and our friends on #corelan (freenode IRC)

Categories