Tuning The Check_MK Apache Server

There are situations, such as in a large organization, where dozens of people may be accessing the Check_MK user interface. This causes increased load on the web server and can lead to the user interface significantly slowing down. In such situations it is necessary to make some simple modifications to the Apache configuration in order to optimize performance. 

In this article we will cover some steps to identify, and remediate this bottleneck.  

NOTE: We will reference metrics that require the Check_MK Agent and the Apache check plugin to be installed on the monitoring server.

1) Identifying if Apache is the root Issue:

Our first step is to take a quick look at a couple key metrics that can help us determine if the issue lies within Apache, or somewhere else on the system.

Looking at the CPU and Memory utilization graphs above, we can see that this system appears healthy and does not exhibit any excessive I/O wait or swap usage. We can reasonably assume that system load is not a contributing factor.

Please note that in cases where memory utilization is very high, continuing to adjust Apache parameters could be detrimental.


Now that we have checked  over our general system health, we can take a look at the Apache service. 

Looking at the above graphs, we can immediately see that our ratio of busy workers to idle workers is very high. 
This is a good indication that Apache may not be able to process all of the current requests. 

2) Making the modifications:

Tuning of Apache is dependent on several other factors but in order to keep things simple, we will only be looking at two parameters which should be sufficient for most installations. 

Open  ~/etc/apache/apache.conf with your favorite editor and look for a section similiar to the following:

StartServers 1
MinSpareServers 1
MaxSpareServers 5
ServerLimit 64
MaxClients 64
MaxRequestsPerChild 4000


1) ServerLimit:
For our example, we will change our ServerLimit to 128.
By doubling our ServerLimit, we are telling Apache that it is allowed to allocate twice as many worker threads to handle our requests. 

2) MaxClients:
We will also set MaxClients to 128. This denotes the maximum requests that may be processed simultaneously. 
Each Apache worker may only handle one request at a time. By setting this the same as our ServerLimit, we ensure that we always have at least one worker available to process the request. 

Once those two values have been modified, save the configuration and restart OMD. 

With these changes, your installation is now able to handle double the default number of requests simultaneously! You can now verify that your new values are sufficient by re-evaluating the idle/busy workers value as discussed above. If you have any questions, or would like assistance, please reach out to TruePath engineering.

References:
https://httpd.apache.org/docs/2.4/mod/prefork.html