Answer the question
In order to leave comments, you need to log in
Why doesn't fastcgi script resume after heavy server load?
After stopping the heavy load on the server (100% load on the cpu within 1-2 hours), the fastcgi script almost stops doing its job. This is expressed in the fact that about 90% of requests to it do not wait for a response from the server.
upstream timed out (110: Connection timed out) while connecting to upstream
fastcgi_read_timeout 10s;
fastcgi_send_timeout 10s;
fastcgi_connect_timeout 10s;
int main(void) {
streambuf * cin_streambuf = cin.rdbuf();
streambuf * cout_streambuf = cout.rdbuf();
streambuf * cerr_streambuf = cerr.rdbuf();
FCGX_Request request;
FCGX_Init();
FCGX_InitRequest(&request, 0, 0);
srand (time(NULL));
while (FCGX_Accept_r(&request) == 0) {
fcgi_streambuf cin_fcgi_streambuf(request.in);
fcgi_streambuf cout_fcgi_streambuf(request.out);
fcgi_streambuf cerr_fcgi_streambuf(request.err);
cin.rdbuf(&cin_fcgi_streambuf);
cout.rdbuf(&cout_fcgi_streambuf);
cerr.rdbuf(&cerr_fcgi_streambuf);
requestNumber++;
cout << "Pragma: no-cache\r\n";
cout << "Cache-Control: post-check=0, pre-check=0\r\n";
cout << "Cache-Control: no-store, no-cache, must-revalidate, max-age=0\r\n";
cout << "Content-type: text/html\r\n\r\n";
float dl = time(NULL) - atof(FCGX_GetParam("REQUEST_TIME", request.envp));
if(dl > REQUEST_TIMEOUT) continue; //не обрабатываем запросы ждущие слишком долго
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question