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

Hello. Up to this point was a bunch of Nginx + Apache2. Apache was there are so many resources over time. So many times I read about a bunch of Nginx + PHP-FPM, and decided to put it.
That is:
1) the site with the attendance of 80k a day
2) configuration of server: 32GB RAM, 8 cores, SSD. 1.4.6, Nginx, memcache, opcache enabled

After a long tuning fpm and nginx, with following config:
Nginx:
config site pastebin.com/u6BVkQzC
main config : pastebin.com/viyWGkjU
FPM:
the main www pastebin.com/Y7iEmndn
config user pastebin.com/QDkjxeNa

When the flow of users be redirected to this server, in the top appear the process php5-fpm , and some loaded almost all at 100%. Gradually the response from the server goes from 60ms to 2 seconds. c2n.me/3yvZfnD All slow and clunky. In the logs this:
*an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/9/00/0000000009 while reading upstream

load average more than 10
Prompt, what not so made? There must be at least better than a bunch of Apache with nginx. I will be glad Your tip.

UPD.
Buffer solved the problem, increased it, now the load average <= 4. It is normal for an opponent of 730k page views per day?
July 9th 19 at 11:26
3 answers
July 9th 19 at 11:28
Set up to start logging slow queries.
and will it make a difference? On Apache for quick runs. Yes and no-load very quickly performed - misael commented on July 9th 19 at 11:31
July 9th 19 at 11:30
You have the requests to fpm via sockets, may be you have a low limit on open files? ulimit in linux

by the way I have zadolbalsya with sockets and made over tcp, the higher your attendance several times
ulimit 8192. If not a secret, what attendance and what is the use of resources in the attendance? - misael commented on July 9th 19 at 11:33
dig, increased buffers, now no errors. Picture the following: c2n.me/3ywyk8L. Per second about 30 queries goes. I think eating too much resources. pastebin.com/hxQsvnQb here is the nginx configuration - misael commented on July 9th 19 at 11:36
July 9th 19 at 11:32
try_files
location
include fastcgi_params; + fastcgi_param in one location
ssi on;
error_log /dev/null crit;
access_log off
pm.max_children = 5

Reference assemblies of errors of the form "how not to do" and "why you'd better use Apache".
(in fairness, a hint on the correct configuration of the fpm, but its processes and sockets - ass).

Well and on a subject - model drives in the Studio. Likely to trouble them.
pastebin.com/tAWUdQW3 the model of the drive system, other disks are the same. The website uses Yii in which Active Record almost everywhere, with the exception of complex queries. I tried to replace the usual DAO, and zakeshirovalo the page completely - the result is obvious: siege says this:
siege-t 2M-c 30 site.info
pastebin.com/PDp9ya3k (with opcache)

It was so pastebin.com/PeNuaHAf (with opcache)
Might indicate why the socket is bad? I have been reading a lot of information, write that in one server it is better to use the socket.
And what about the number of processes is put more load average just flew into oblivion. About other parameters, even can not say anything except ssi off; Could instruct on the right path? - misael commented on July 9th 19 at 11:35
: load average is a figure that can wipe. It is needed in order to respond to sharp changes.

Look at the time of response and non-response. And to salt - iron to no purpose. If more processes are faster and less non-response, then let them be more.

Sockets under high load behave worse than tcp. TCP in Linux tunat all and Sundry, on code about unix sockets all forgotten. Besides (I could be wrong, can't remember) in fpm, most likely, the socket is single-threaded, that is, at the same time can be one request/be given one response (to be handled inside php - indefinitely). - misael commented on July 9th 19 at 11:38
: thanks, I'll watch. Tell me, Vlad, what's wrong with try_files? Due to the extra checks? location just do not understand why You included this list. Looking for exceptions to the rule, but could not understand. - misael commented on July 9th 19 at 11:41
:
try_files hell is not needed, there will need to config the project to write and not copy.

location - it is rather a reference to the fact that you are using a unix socket. The most tested and refined at speed code in nginx, again, in the area of the "proxy_pass" +http. - misael commented on July 9th 19 at 11:44
: thanks for the info. By the way, increased the number of child processes, like uses even less CPU resources. Really don't trust the tests on one page, you need to "baptism of fire" - eldon_Batz84 commented on July 9th 19 at 11:47

Find more questions by tags NginxPHPPHP-FPM