I am playing around with Magento CE on Nginx and its working fine.
Problem starts when I do a 500 user load test. The php-fpm
process hogs up all the CPUs to 100% and I start getting 404 as the response.
Here's my nginx config
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=magento:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
server {
...
location ~ \.php$ {
try_files $uri =404;
expires off;
fastcgi_cache magento;
fastcgi_cache_valid 200 60m;
fastcgi_cache_methods GET HEAD;
add_header X-Fastcgi-Cache $upstream_cache_status;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
fastcgi_read_timeout 900s;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
I am a bit new to nginx
and fastcgi
so not really sure what configs I should be focusing on.
I have enabled zend opcache so I believe it php-fpm
should not be under stress. Is this assumption correct?
A friend of mine says its expected behaviour and it would go 100% on a 2 core machine. But I find it hard to believe. Nginx is performing blazing fast if I do a static file load test. Its just PHP which is slowing it down.
Thought?