Answer the question
In order to leave comments, you need to log in
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.
The RAM and CPU on the server are not loaded, judging by the statistics, the stock is still decent.
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
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
I would be grateful for any thoughts.
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 :)
The main reason was - limiting the maximum possible simultaneous connections to Apache.
"server reached MaxClients setting, consider raising the MaxClients setting"
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 questionAsk a Question
731 491 924 answers to any question