Apache is the most widely used web server in the world, so knowing a little about how it works in order to optimize it is very important. There are websites that need different configurations from the ones Apache has configured by default. Here we will discuss the use of KeepAlive.
What is KeepAlive?
KeepAlive allows the server to use the same connection to transfer multiple files.
Advantages of KeepAlive:
- Increases website speed: Reduces the latency associated with HTTP transfer.
- Reduces CPU usage: Activating KeepAlive reduces CPU usage. Consider that a website with several images, files and so on, the server will need to make a connection for each file, increasing CPU usage. With KeepAlive activated, only one connection is made, thus reducing CPU consumption.
Disadvantages of KeepAlive:
- Increases memory usage: Activating KeepAlive increases memory usage on the server. Apache processes have to keep connections open waiting for new requests from established connections.
When should I activate KeepAlive?
It will depend on various situations such as the amount of resources on your server, the type of website and so on. On a server with little Ram available, it is recommended to use KeepAlive Off, thus reducing memory usage and allowing the server to serve more users. If you care a lot about the user’s experience with the website and your server has a good amount of RAM available, if your website has a lot of images or other files, it is recommended to keep KeepAlive activated.