S
S
svsova2020-02-19 17:13:38
PHP
svsova, 2020-02-19 17:13:38

Who is to blame for the server not pulling or the scripts need to be finished?

I have an entertainment site https://www.vip-nickname.ru/ .
The site on the VPS server is the only one (Processor 2x2200, Memory 2048, OS centos6-x86_64) .

There is some problem with loading it. Basically it works fine, the pages scroll quickly, the execution time of php scripts is approximately 0.02 s. But at rush hour Saturday-Sunday users online up to about 100 people. brakes start. It happens that pages do not load at all, for a long time, but they do not load at all.
5e4d3f834487e261229025.png
The RAM and CPU on the server are not loaded, judging by the statistics, the stock is still decent.
5e4d4023b2ad6359552442.png
5e4d402caf0fa812485124.png
When I open the console and reload the web server, I reload the page, everything starts to fly.

I don’t understand where to drip, there seems to be no superfluous processes. I would be grateful for any thoughts.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
P
Puma Thailand, 2020-02-19
@svsova

What is there to think stupidly look at the logs and fix the rise of the
Problem, instead of guessing on the coffee grounds as the author suggests

T
ThunderCat, 2020-02-19
@ThunderCat

I would be grateful for any thoughts.

Thought - it would be nice to do profiling with timing for the code, you can look at which operation the plug usually occurs during load.

M
metajiji, 2020-02-20
@metajiji

php-fpm with a configured restart of workers, for example, by the number of requests - 1000 will be fine. + Logging slow requests, you also need to configure - specify the execution timeout. Well, for a bunch of autoscaling workers, so that there are 15 pieces in idle time, and more can be done under load, for example 50.
In the future,
When you realize that the server is over, you can insert the next one, which means just start another VPS with php-fpm.
If there are uploads, then you need to decide how to make them shared, if the record is not very active, glusterfs or nfs may be suitable. Both solutions are so-so, ideally uploads to cdn.
And yes, the base will need to be expanded between the nodes :)

S
svsova, 2020-02-20
@svsova

The main reason was - limiting the maximum possible simultaneous connections to Apache.

"server reached MaxClients setting, consider raising the MaxClients setting"

I increased it by 3 times, and corrected other server settings on the same topic.
Immediately after the problem was fixed, traffic grew by about + 20% online even more.
5e4e3c5f30a09385123300.png
I will also consider other offers, it looks like I will have to spend more time there.
Thanks EVERYONE for the help!

A
Alexander Galushko, 2020-02-20
@unnforgiven

Where is monitoring io?

F
Foxcloud Foxcloud, 2020-02-21
@FoxCloud

1. If the site is running on php-fpm, optimize php-fpm. Take a look at the options below. For example, the values ​​for the test can be:
emergency_restart_threshold 10
emergency_restart_interval 1m
process_control_timeout 10s
2. If the backend is Apache (httpd), we recommend using the server-status capabilities of Apache.
Conf file:
/etc/httpd/conf/httpd.conf
Add parameters to the configuration file
SetHandler server-status
Order deny,allow
Deny from all
#Allow
from 123.123.123.0/20
Test apache config
httpd -t or apachectl configtest
Restart apache
service httpd reload or restart (if reload did not work)
At the time of loading, check the status at the link:
xn--__-7kcbjalibbz8fqdckb/ixstatus
3. At the time of loading, look at the TOP on the server.
Analyze processes.
4. If you are using php-FCGI, make the settings as well.
Most often, the configuration file is here:
/etc/httpd/conf.d/fcgid.conf
Make the settings at the end of the file and restart Apache.
FcgidProcessLifeTime 14400
FcgidIdleScanInterval 60
FcgidIdleTimeout 60
FcgidMaxProcesses 3000
FcgidMaxProcessesPerClass 500
FcgidMaxRequestsPerProcess 100
FcgidMinProcessesPerClass 0
FcgidMaxRequestLen 200000000
FcgidIOTimeout 300
Test apache config
httpd -t or apachectl configtest
Reload apache
service httpd reload or restart (if reload didn't work)
Above are a few options that can help you.
If it does not help, you need to diagnose the problem in order to identify a solution.
We wish you good luck in resolving the issue!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question