Apache workers, also known as Apache worker processes or worker threads, are a component of the Apache HTTP Server that handles incoming client requests. Apache worker processes use a threaded approach to handle multiple connections within a single process. Each worker thread is capable of handling multiple requests simultaneously, leading to improved performance and reduced resource consumption compared to the prefork model.
Apache workers are highly configurable, allowing administrators to control the number of worker processes and the maximum number of connections each worker can handle. However, it is important to strike a balance between the number of workers and available system resources to avoid overloading the server. Efficient management of Apache workers is crucial for optimizing the performance and scalability of the Apache web server.
If a VPS or Dedicated server is using all of its available Apache workers, sites may load slowly or not at all. You may also see errors publicly, as well as in certain logs. This article will explain the process of checking and raising Apache workers.
Errors you may see will look like the following. The first is seen publicly when visiting the site, and the second is from the command line.
AH00287: server is within MinSpareThreads of MaxRequestWorkers
300 requests currently being processed, 0 idle workers WWWWWWWWWWWWWWRWWWCWWWWWWWWWWWWWCWWWWWWWWWRWWWRWWWWWWWWWWWRWWWWW WCWWWWWWWWWWWWWWWWRWWWWWWWWRWWWWWWWWWWWWWWRWWWWWWWWWWWWWWWWWWRWW WRWWWWCWWWWWWWWWWRWWWWWWWWWWCWWWWWWWWWWWWWWRWWWWWWWWWWWWWWWWWWWW WRWWWWWWWWWWWWWRWWWWWRWWWWWWCWWWWWWWWWWWWRWWWWWWWWWWWWWWWRWWWWWW WWWWWWWRWWWRWWWRWWWWRWWWWWWRWWWWWWWWWWWWWWWW
Increase Apache Workers
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
- SSH into the server as root
- Before proceeding, review the following
- Check for IPs that may be flooding Apache with the following command
/opt/*rads/show-conns --http
NOTE: If there is flooding, it is recommended to mitigate the flood instead of increasing workers. - Check the Apache Scoreboard with the command
apachectl status
- Review the Apache error logs for MaxRequestWorkers errors using
grep 'server reached MaxRequestWorkers' /var/log/apache2/error_log
- Check for IPs that may be flooding Apache with the following command
- Log into Root WHM
- Navigate to Apache Configuration, located under Service Configuration
- Click Global Configuration
- Scroll down to Max Request Workers and increase the value
TIP: It is recommended to check server resources before increasing the number of workers. cPanel has a guide on this. - Locate Server Limit and confirm that it is at least as large as the new Max Request Workers value
- Click Save
- Click Rebuild Configuration and Start Apache
TIP: You can also increase maxclients in /var/cpanel/conf/apache/local
and manually rebuild and restart Apache. Further information on performance tuning Apache and MaxRequestWorkers can be found in the Apache documentation.
Comments
0 comments
Article is closed for comments.