Improving WAMP Performance
One of the painful points of doing PHP development is the time that one has to wait for the PHP scripts to render the page, especially when using CMSes and frameworks which involve a lot of server-side PHP processing.
Of course, PHP can be cached as bytecode, though in development we often need to flush the cache in order to see the results of our changes.
Looking into other peoples' experiences (such as this and these), there seems be a number of tuning solutions to make a local WAMP installation serve faster.
I decided to put a few of these suggestions to the test on my development machine (a Windows 7 64 bit Core i5-3470 CPU @ 3.20GHz, with 8Gb RAM), specifically:
-
Adding
EnableMMAP
on andEnableSendfile on
to the apache conf -
AddingÂ
realpath_cache_size = 2M
to php.ini -
Adding the following entries to the hosts file:
127.0.0.1 localhost 127.0.0.1 127.0.0.1
The results really speak for themselves in the following graph, where I used Apache's ab tool with a Silverstripe installation to perform the tests. The ab string used was:
$ ./ab -n 10 http://localhost.nppa/?flush=1
where:
-n 10
means ten successive requests- the
?flush=1
parameter forces Silverstripe to serve a non-cached version of the page
Impact on performance
(shorter bars = faster Time per Request)
Shorter bars equals a faster performance, as measured by Apache ab's Time per Request, and the only solution that made a significant difference was the addition of the following entries into the hosts file (though it seems increasing realpath_cache_size
in the php.ini also helps marginally):
127.0.0.1 localhost
127.0.0.1 127.0.0.1