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:
- Rebooting the computer
- Reinstalling Uniserver
- Toggling the debug level from 2 to 0
- Switching to APC cache from FileCache
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:
- ThinkPad T400
- Intel Core 2 Duo processor
- OCZ SSD
- 4 GB RAM
- Windows 7 64-bit edition
- CakePHP version 2.2.3
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:
- PHP error levels (E_ALL, E_NOTICE, E_STRICT, etc.)
- $php_errormsg logging
- mysqlnd.collect settings (2 of these)
- Disable Xdebug
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.
(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.