Beginner Fundamentals
Performance Tuning Basics
A few simple settings can make Apache faster and more efficient. This lesson introduces the most common ones for beginners.
KeepAlive
KeepAlive lets a browser reuse one connection for several requests, avoiding the cost of opening a new one each time:
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
MaxKeepAliveRequests: how many requests per connection.KeepAliveTimeout: seconds to wait for the next request before closing.
Timeout
Timeout sets how long Apache waits on a slow client before giving up:
Timeout 60
A lower value frees up workers faster but may cut off very slow connections.
MPM Worker Limits
The active MPM controls how many requests can run at once. With the event MPM:
<IfModule mpm_event_module>
StartServers 2
MaxRequestWorkers 150
ThreadsPerChild 25
</IfModule>
MaxRequestWorkers caps the total simultaneous requests, protecting memory.
Disable What You Do Not Need
Turn off unused modules and avoid .htaccess when possible. Each adds overhead.
Test and Reload
sudo apache2ctl configtest
sudo systemctl reload apache2
Start with these defaults, then measure real traffic before tuning further.