D
D
Dmitry2016-05-26 17:52:56
PHP
Dmitry, 2016-05-26 17:52:56

Why is the web server buggy (Nginx + php5-fpm)?

Hello. Until now, there was a bunch of Nginx + Apache2. Apache began to eat a lot of resources over time. I read a lot about the Nginx + PHP-FPM bundle, and decided to install it.
What is:
1) a site with 80k traffic per day
2) server config: 32GB RAM, 8 cores, SSD. Nginx 1.4.6, memcache, opcache enabled
After a long setup of fpm and nginx, the following configs are available:
Nginx:
site config pastebin.com/u6BVkQzC
main config : pastebin.com/viyWGkjU
FPM:
main www pastebin.com/Y7iEmndn pastebin
user config . com/QDkjxeNa
When I redirect the user flow to this server, in topphp5-fpm processes appear, and some load almost everything at 100%. Gradually, the response from the server from 60ms goes up to 2 seconds. Everything slows down and buggy. This is what is in the logs:

*an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/9/00/0000000009 while reading upstream

load average is more than 10
Tell me what's wrong? It should be at least better than in conjunction with Apache and nginx. I will be glad to your tip.
UPD.
I solved the problem with the buffer, increased it, now load average <= 4. Is this normal for 730k page views per day?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanes, 2016-05-26
@Sanes

Set up logging for slow queries first.

A
Anton B, 2016-05-26
@bigton

You are making requests to fpm via sockets, maybe you have a low limit on open files? ulimit in linux, by the
way, I got stuck with sockets and did it via tcp, attendance is several times higher than yours

V
Vlad Zhivotnev, 2016-05-27
@inkvizitor68sl

try_files
fastcgi_pass
include fastcgi_params; + fastcgi_param in one location
ssi on;
error_log /dev/nullcrit;
access_log off
pm.max_children = 5
Reference assembly of "how not to do" and "why you should use apache" errors.
(in fairness, there is a hint of the correct configuration of fpm itself, but there are few processes and sockets are an ass).
Well and on a subject - model of disks in studio. Most likely they are the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question