Understanding "keep alive" settings
LiteSpeed Web Server's default configuration turns “keep alive” on. There is no “yes/no” or “on/off” option in LiteSpeed Web Server's settings. However, you can turn it off or control it through the Max Keep-Alive Requests
, Smart Keep-Alive
, and Keep-Alive Timeout (secs)
settings (under the LSWS Admin Console → Server → Tuning → Connection section).
You don't need to enable Smart Keep-Alive
to be able to use “Keep-Alive”. Smart Keep-Alive
is designed to “turn off” Keep-Alive for some types of files, instead of “turning it on”. For example, it will “enable” keep-alive for JavaScript, CSS, image file requests, and disable it for other type of files, such as HTML files. Since LSWS 5.1.8, Smart Keep-Alive
will only disable keep-alive for HTML files. If you would like to use keep-alive for everything, you must turn off Smart Keep-Alive
.
“Keep-alive” is server level configuration and can not be controlled at virtual host level.
Controlling "Keep-Alive"
Setting Max Keep-Alive Requests
to “0” will disable “keep-alive”. You should leave this as the default value if you have no special requirements, increasing it slightly as needed or even adjusting it to a large value, like “100,000”, when you do a benchmark test.
The default value for Keep-Alive Timeout (secs)
is “5”. You don't need to adjust this either unless you have some special requirements.
Sometimes you may not see a Keep-alive
header for a particular URL. This does not mean that “keep-alive” is off. To troubleshoot this you may turn off Smart Keep-Alive
and increase the value of the Max Keep-Alive Requests
setting. Sometimes a PHP external application “Soft Limit” may also limit “keep-alive” connections. Increasing this “Soft Limit” may also fix this issue.