Articles in this section

Apache keeps going down on a Plesk server: server reached MaxRequestWorkers setting

Plesk for Linux kb: technical FR:PPM-2076 apache

Applicable to:

  • Plesk for Linux

Symptoms

  • Websites on the server are experiencing 504 Gateway Time-out nginx error consistently after working without issues for a period of time.
  • The Apache web server goes down periodically with the following error message in Apache error log:
    • on CentOS/RHEL-based distributions: /var/log/httpd/error_log
    • on Debian/Ubuntu-based distributions: /var/log/apache2/error.log

      CONFIG_TEXT: AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting


      CONFIG_TEXT: server is within MinSpareThreads of MaxRequestWorkers, consider raising the MaxRequestWorkers setting

  • The following error message is logged in domain's log at Plesk > Domains > Logs:

    CONFIG_TEXT: [error] 26927#0: *417 connect() failed (110: Connection timed out) while connecting to upstream, client: 203.0.113.2, server: example.com, request: "GET /?amp HTTP/1.1", upstream: "https://203.0.113.2/?amp", host: "example.com"

  • Requests are being served slowly or not served at all, and therefore, the websites become inaccessible, even though the server's CPU and RAM resources are not exhausted.

Cause

The server is receiving a large number of requests, which is causing the Apache web server to reach its MaxRequestWorkers limit. A large number of requests may be caused by an increase in website visitors or a DDoS attack.

Resolution

  1. Ensure the server isn't under attack. You can use this article to do this:
    How to diagnose a DoS/DDoS attack and find websites under attack on a Plesk server
  2. If an attack has been detected, it is necessary to take measures to protect the server from attacks as described in this article: What DDoS protection tools are available in Plesk
    If no attacks are detected, proceed to the next step.
  3. You need to monitor the server using this article: How to monitor usage of system resources in a period of time using atop
    - If the CPU and memory load are not high <60%, you can increase the parameter MaxRequestWorkers using this article: How to calculate and adjust the MaxRequestWorkers limit on the server with Plesk.
    You have a reserve of resources up to 80% load.
    - If the server's processor or memory is loaded at 80% or more, it's necessary to increase the number of processor cores or the amount of RAM on the server, depending on which resource is overloaded.
    Once the server resources have been expanded, you can begin to increase the parameter MaxRequestWorkers so that the server can handle more requests. To calculate the MaxRequestWorkers Use this article: How to calculate and adjust the MaxRequestWorkers limit on the server with Plesk

Note: Increasing the limit MaxRequestWorkers should only be done after a full investigation of the server using the articles provided above.

Was this article helpful?

Comments

1 comment
Date Votes
  • Hi Kuzma Ivanov,

     

    Please note that the results of calculations for lots and lots of servers, of the below, to the best of my understanding totally does not suit, the default recommended values, as set in this current article. 

    Can you please advise?

     

    MaxRequestWorkers = (Total RAM - Memory used for Linux, DB, etc.) / average Apache process size

    • MPM Event: The default ServerLimit value is 16. To increase it, you must also raise MaxRequestWorkers using the following formula: ServerLimit value x 25 = MaxRequestWorkers value. For example, if ServerLimit is set to 20, then MaxRequestWorkers will be 20 x 25 = 500.

    • MPM Prefork: The default MaxRequestWorkers value is 256. To increase it, you must also raise ServerLimit.

     

    MPM EVENT

    MaxRequestWorkers 400
    ServerLimit 16
    0

Please sign in to leave a comment.