Partner and Community Forums
IIS7.5/PHP5 Performance problem at first call or after 5 minutes
Last post Apr 16, 2015 06:12 AM by Vincent O
Apr 15, 2015 10:03 AM|Vincent O|LINK
Hello to all,
Here is a problem I can't get rid off even after several entire days testing every little trick I could find on the Internet...
My config :
- IIS 7.5 on a brand new 2008 R2 server
- Windows and IIS are up to date
- 64 Giga of RAM
- 2 x E5-2420 v2 @ 2.20GHz processors
- php 5.6.4
- 32 bit - Non thread safe - VC11 version
- running in FastCGI mode.
- IIS app pool recycling tuning applied (PHP_FCGI_MAX_REQUEST 10000 / IIS Max instance request 10000 ).
- My php website
- running in it's own 32 bit app pool
My problem :
At the moment, the website being Under developpement, I'm the only user to connect to it.
When all is going as expected, the response time is quite fast : Under 0.05 sec from a click to get the next page displayed.
When all is going wrong, it becomes really slow in comparison : From 2 to 8 seconds (depending on the number of redirections needed by the website to reach the displayable page) from a click to the next page displayed.
I've determined that the slow times occurs...
- when I open the first php session since 5 or more minutes
- when I use the same php session for 5 or more minutes
When in a slow session, disconnecting from the current session ( session_unset() + expire cookie + session_destroy() ) and starting a new one makes it become fast again.
The slow time occurs inside the session_start() function but out of the parts of it I can tune : I stored the session data in an Orcale database and wrote a custom session handling class and I can observe that the time spent for session data retrieval from
the database is approximatly always the same and is under 0.05 seconds most of times.
The slow time takes place after session::read() but before the end of the session_start() function.
I tried to fall back to an older php version (5.3.13) on the same server ... no change.
I tried the same website on a 2003 R2 server / II6 / php 5.3.13 FastCGI .... no change.
I'm tearing my hair off about this problem so any help would be appreciated.
Thanks in advance.
Apr 16, 2015 06:12 AM|Vincent O|LINK
Ok I got it...
I begun to doubt when testing the same website on the 2003 R2 / IIS6 / php5.3.13 server ... and this doubt has just confirmed :
The problem is not linked to IIS nor php at all ! It is in my php code !
My website uses several DB connexions :
- One to a Oracle 11 DB on Windows for the website management
- One to a Oracle 10 DB on Windows for some business data retrieval
- One to a DB2 DB on AS400 for other business data retrieval
I place those connexions in session when calling them for the first time and reestablish the connexion to it at each session_start() call by using the __awake() funtion.
Most of times I only use the two Oracle ones... except when some kind of data have not been refreshed since at least... 5 minutes !
In this case I open the DB2 connexion which is A LOT slower : from 0.8 to 2 seconds depending on the activity of the AS400 server versus 0.015 seconds for the two Oracle DBs.
This explains the delay observed and the 5 minutes time slot.
Now I have to find an expert as I know quite well Windows and Oracle but I know not much about AS400 nor DB2 -_-'
By the way... sorry for posting in this forum as the problem was elsewhere !
At least my post allowed me to write down what I've done and made me ask the good questions.
Thanks to those who took the time to read.