performancecakephpxdebugkcachegrind

CakePHP Pages Slow To Load Due To php::session_start


I found that pages in my CakePHP application that do not call the database take about 4 seconds to load, which is way too slow.

I tried the following things to no avail:

I got an XDebug profiler dump and observed in KCachegrind that the most time consuming function was php::session_start and that it was called by \webroot\index.php. I also checked the performance using the CakePHP Debug Kit and found that the most time consuming item was "Core Processing (Derived from $_SERVER["REQUEST_TIME"])".

What can I do to get my pages to load faster?

In case my hardware is relevant, I have described the operating environment below:

As a starting point, I compared my working copy of php.ini with the production version of php.ini provided by Uniserver and found the following major differences:

Then, I did some before and after comparisons. The green cells are values that are <= 1 second, which is the limit for humans perceiving something is "pretty fast." I realize that actually, one must be <= 0.1 seconds to be "instant" but that's seems a bit unrealistic.

Comparison of processing time required to display CakePHP pages

(To view the image in full-size, go to Windows SkyDrive at http://sdrv.ms/YomWdO.)

I tried using the website application while running under the "After" version of php.ini and things aren't awful but I still feel like I've hit a road bump when I launch most pages, especially when I can launch some pages instantly.


Solution

  • The solution is to change the following settings:

    Then, get a dedicated production server so that you don't have to keep switching copies of php.ini.

    Last of all, if that doesn't speed things up enough and it's just a personal project (though it might be a critical personal project), give up and move on with life.