Had a problem the other day when trying to optimise the performance of a site that was on my companies in-house content management platform. Now the speed of the response to generate the HTML was not the issue. The issue was that all of the content managed assets were taking seconds to load in. Now this was the first site that we had that the client had included quite a lot of cm images on all there pages.
Trying to debug the issue was difficult the images them self would load in a matter of milliseconds. Using operas dragon fly feature could see that it wasn’t a bandwidth issue, and no data was been sent from the server for seconds.
Now I didn’t know it but is seems that php’s session handling is blocking on a per request basis. Kinda makes sense if you think about it, that if two requests simultaneously try and change a session variable then you would get constancy issues. So php handles this by making session_start() a blocking action and will wait for any other request to either finish or close the session using session_write_close().
For me it came down to only starting the session when necessary and closing it as son as your finished with it. As it turned out the best solution for us on the cm images was to check to see if any permissions were set on the images before seeing if we needed to start the session.