I'm using Laravel 4.2, when I navigate through the pages the PHP-FPM spikes to 10-20%.
I checked it on 2 environments:
A:
Nginx Balancer - 2 CPU, 2GB.
PHP-FPM server - 1 CPU, 1GB.
MySQL server - 2 CPU, 2GB.
B:
Simple VPS on linode of 1 CPU, 1GB.
*SSD on all servers.
Now, I started investigating it more deeply using JMeter:
JMeter settings:
Number of Threads(users) - 100.
Ramp-Up Period(in seconds) - 1.
Loop Count - 5.
Laravel 4.2, sent the requests to:
Route::get('/test', function() { echo "Test"; });
Results: about 40 seconds of CPU on 100%.
Laravel 5.2(clean installation), sent the requests to the welcome page.
Results: CPU usage on 100% for 20 seconds.Phalcon(clean installation): sent the requests to Hello world page.
Results: CPU usage on 50% for 2 seconds.Codeiginiter(rest api server, same config): sent the requests to a page that loads data from the DB(returning JSON).
Results: CPU usage on 55%-60% for 3 seconds.- Same results on both environments.
- Disabled debug mode, database connection, changed the configs and so on.
PHP-fpm config:
pm.max_children = 9
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
I understand that Laravel should be slower but I doubt the difference should be that big? I googled for hours, I encountered a few posts that have the same issue as mine but without any solution:
http://laravel.io/forum/09-25-2014-what-steps-should-i-take-to-reduce-laravels-high-cpu-load
http://laravel.io/forum/08-12-2014-cpu-load-general-performance-question
What am I missing here?
Thanks in advance.