Apache Tuner
Luke Hebert
- 2 minutes read - 305 wordsApache Tuner is a lightweight Perl script that reads your running Apache configuration and cross-references it against your system’s CPU cores, available memory, and current load. It then prints a set of concrete suggestions for tuning your MPM (Multi-Processing Module), KeepAlive behavior, and worker/thread counts so the server can handle more concurrent connections without wasting resources.
What It Checks
- MPM settings – worker, thread, and process counts relative to your CPU core count.
- KeepAlive – whether persistent connections are enabled and whether
KeepAliveTimeoutis reasonable. - MaxClients / MaxConnectionsPerChild – whether the limits are too low for your traffic or too high for your RAM.
- Memory headroom – a rough estimate of how much RAM Apache will consume at peak and whether that fits your box.
- Thread and process ratios – flags when the ratio looks off for your workload (CPU-bound vs. I/O-bound).
How to Use It
Download the script (attached below) and place it on the target server.
Run it with Perl:
perl apache-tuner.plRead the output. Each suggestion includes the current value, the recommended value, and a short explanation of why the change helps.
Apply the recommended values to your Apache configuration (typically
httpd.confor a file inconf.d/).Restart Apache and verify with
apachectl statusor your monitoring stack that the new settings behave as expected.
Treat the suggestions as a starting point, not gospel. Production workloads vary widely, so benchmark before and after any change and roll back if response times or error rates regress.
Notes
- The script is read-only; it does not modify any configuration files.
- It works best on Linux and FreeBSD. On other platforms some checks may be skipped.
- If you are running Apache behind a reverse proxy (nginx, HAProxy, etc.), some of the KeepAlive and MaxClients recommendations may not apply the same way.