Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » Keepalive Settings: Understanding keepalive configuration
  • sandboxx
    Use Windows Sandbox as a security feature Virtualization
  • Slide1 4
    How to create and configure a Shared Folder on Windows Server Windows Server
  • dfggg
    SimpleSAMLphp Setup on Windows Server [Part 1] Windows Server
  • Featured image 9
    Create and Delete Registry Keys via PowerShell in Windows Scripts
  • 1 WeXxkEX0JG3oB781HD8Hrg
    Error 0x204: Unable to Connect to Remote PC [Part 1] Windows Server
  • ref error
    Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory Version Control System
  • Feature image
    When Should I Use TPM or TPM + PIN Security | Vulnerability Scans and Assessment
  • Actualidad 211741393 129861581 1050x760
    Edge GPO settings: All Group Policies available to configure Microsoft Edge Settings Windows Server

Keepalive Settings: Understanding keepalive configuration

Posted on 19/10/202031/08/2023 Christian By Christian No Comments on Keepalive Settings: Understanding keepalive configuration
Network protocols

The keepalive utility helps to manage web traffic and optimize the use of system resources. With the increase in the number of internet users, the workload on web servers also increases.

The system administrator hence, has to ensure the server is capable of putting up and accommodating the number of connection requests. If the number of users accessing the server increases, the whole system may begin to slow down in terms of access speed; it will become necessary at this point to perform routine tcp tuning on a Linux system. This is where the keepalive utility comes into play

Basically, the keepalive keeps a webpage active for a specified period of time after the user has abandoned it. When there is a high volume of users on a server, a decrease in the timeouts on a tcp socket will hence clean up the connections from the clients that are no longer active.

However, when the server is not busy, the default settings for the keepalive utility should be adequate. There are a couple of other parameters defined that I will explain a little later. This utility kills the connection to the server after completion of each client request. With Keepalive utility, it is possible to use the same tcp connection for all the http requests.

Keepalive Configuration


The following is the default configuration of the keepalive utility:

tcp_keepalive_time = 7200
tcp_keepalive_intvl = 75
tcp_keepalive_probes = 9

[all the above values are measured in seconds except the keepalive_probe which is just a number value]

  1. Keepalive_time: this refers to the time of a connection’s inactivity before a keepalive probeis sent.
  2. Keepalive_interval: this refers to the wait time before another keepalive probeis sent.
  3. Keep_alive probes: this is the number of probes that will be sent before the connection is terminated.

Now according to this default setting, our setup will detect an idle in connection in

[7200 + (75 * 9)] seconds = 7,875seconds.
By default, keepalive is not active on a Linux system. To setup,

Keepalive Setup


1. Activate the keepalive tool. By default is off. To activate it, open up the apache configuration file at /etc/httpd/conf/httpd.conf and include the following:

KeepAlive on

2. Open the /etc/sysctl file with your editor and put in the following values:

net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 5 net.ipv4.tcp_keepalive_probes = 6

Connection maintenance

The values you choose to use are entirely up to you. It should not be too little or too much if your website’s traffic is much.             

3. Now save and quit the editor. Use sysctl –p to apply these changes to your configuration.

And you are done. Now, there are a couple of sites you can test your set up’s efficacy in terms of understanding keepalive configuration (I am not going to advertise for them). All they require is the name of your website. You can also use a tool such as GTMetrix to check your settings.


In summary,


The keepalive utility helps reduce load time on a server when there are multiple requests on the server. To enhance website performance amid heavy traffic, consider utilizing the keepalive utility. This involves understanding keepalive configuration for efficient server-client communication. After enabling it, it automatically opens and closes connections by itself, depending on usage.

However, if you are using a shared hosting provider, there is the likelihood that it will slow down your server.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:TCP/IP

Post navigation

Previous Post: Linux Machine: Is it Virtual or a Physical server
Next Post: All available Policies for the latest version of Microsoft Edge

Related Posts

  • Errno 256 No more mirrors to try 1
    How to solve Errno 256 Linux
  • linux windows 10
    Windows Subsystem for Linux: How to install WSL on Windows 10 Linux
  • TERRAFORM ON LINUX FEATURE IMAGE
    How to Install Terraform on Linux Linux
  • Jenkins
    How to Install Jenkins Automation Server on Ubuntu 20.04 LTS Linux
  • screenshot 2020 05 05 at 22.42.35
    How to run Windows applications on Linux via WineHQ Linux
  • Header image
    How to setup a Third-Party DNS Server on a Linux Server Linux

More Related Articles

Errno 256 No more mirrors to try 1 How to solve Errno 256 Linux
linux windows 10 Windows Subsystem for Linux: How to install WSL on Windows 10 Linux
TERRAFORM ON LINUX FEATURE IMAGE How to Install Terraform on Linux Linux
Jenkins How to Install Jenkins Automation Server on Ubuntu 20.04 LTS Linux
screenshot 2020 05 05 at 22.42.35 How to run Windows applications on Linux via WineHQ Linux
Header image How to setup a Third-Party DNS Server on a Linux Server Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • sandboxx
    Use Windows Sandbox as a security feature Virtualization
  • Slide1 4
    How to create and configure a Shared Folder on Windows Server Windows Server
  • dfggg
    SimpleSAMLphp Setup on Windows Server [Part 1] Windows Server
  • Featured image 9
    Create and Delete Registry Keys via PowerShell in Windows Scripts
  • 1 WeXxkEX0JG3oB781HD8Hrg
    Error 0x204: Unable to Connect to Remote PC [Part 1] Windows Server
  • ref error
    Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory Version Control System
  • Feature image
    When Should I Use TPM or TPM + PIN Security | Vulnerability Scans and Assessment
  • Actualidad 211741393 129861581 1050x760
    Edge GPO settings: All Group Policies available to configure Microsoft Edge Settings Windows Server

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,841 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.