3 ways to improve Apache web server performance

The Apache web server is the most popular web server due to its power and versatility. However, as traffic to your website scales, Apache performance can become a significant issue for your visitors. Learn three easy ways to improve the performance of your Apache web server.

$1 Domain Names

Register great TLDs for less than $1 for the first year.

Why wait? Grab your favorite domain name today!

Matching email
SSL certificate
24/7/365 support

Requirements

  • A Cloud Server with Linux (Ubuntu 16.04 or CentOS 7)
  • Apache web server installed and running
Note

Apache is installed and running on a Standard Linux installation by default. If your server was created with a Minimal installation, you will need to install and configure Apache before you proceed.

Update Apache

As with all software on your server, it is important to keep Apache up to date. Newer versions of Apache include bug fixes and performance improvements which can greatly increase the security and performance of your web server.

You can check for newer software versions and update installed packages with the command:

  • CentOS 7:sudo yum update
  • Ubuntu 16.04sudo apt-get update

Remove the burden of processing code from Apache

Apache modules provide a quick and easy solution to process the code needed to operate your website. Some of the most popular modules are mod_php for PHP, mod_rails for Ruby on Rails, and mod_python for Python.

However, these modules come with a price: they put the burden of code processing on Apache, which can slow down website response times across the board.

To improve Apache's performance, consider migrating to these alternative solutions instead:

Dedicated Hosting - Powerful web hosting with dedicated hardware

Fast and scalable, starting from $55/month!

Fast
Secure
State of the art

Change Apache's MaxKeepAliveRequests, KeepAlive, and KeepAliveTimeout settings

Three important Apache settings which can be tuned for improved performance are the MaxKeepAliveRequests, KeepAlive, and KeepAliveTimeout.

MaxKeepAliveRequests sets the maximum number of requests to accept per connection. The higher this number, the better the performance of the server, up to a point. The recommended value is 500.

KeepAlive sets whether Apache will allow more than one request per connection. This is set to Off by default on CentOS 7. High-traffic servers can see a significant performance improvement by changing this setting to On.

KeepAliveTimeout sets the number of seconds Apache will wait for a new request from a connection before it closes the connection. This number should be kept low. The recommended value is between 1 and 5.

To change these settings, open the main Apache configuration file for editing:

  • CentOS 7:sudo nano /etc/httpd/conf/httpd.conf
  • Ubuntu 16.04:sudo nano /etc/apache2/apache2.conf

Add the following lines to this file, customizing the values to your preference:

MaxKeepAliveRequests 500
KeepAlive On
KeepAliveTimeout 3

Save and exit the file. Then restart Apache for the changes to take effect:

  • CentOS 7:sudo systemctl restart httpd
  • Utu 16.04:sudo systemctl restart apache2
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.