PHP and Redis – Performance – PHP is a bottleneck
I have installed Redis 2.4 on my Ubuntu Desktop 11.10, 8 cores, and 8 GB of memory.
When running the redis-benchmark tool, I always see 100K of SETS and GETS per second and 4096 bytes of packets. Apache will process 24k index.html pages per second, so these numbers are very good.
When testing the performance of the total stack – Apache – PHP5 (using Fastcgi) and Redis have a maximum throughput of 250 requests per second.
If I comment out calls to Redis, I still get 250 requests per second.
With htop, CPU usage is 95% PHP and 5% Redis, and Apache is barely visible.
So the question is what throughput should I actually expect for this combination?
PHP 5.4 and Apache 2.2.20
Linux 3.0.0-17-generic#30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64
I recommend using microframeworks instead of larger frameworks for PHP. Also, if you include many PHP files, performance will degrade (even with APC). In addition, PHP r/s does not match static html r/s.