user1558796
user1558796

Reputation: 291

How can I activate keep-alive, http://www.webpagetest.org indicates that keep-alive is not activated

I have used http://www.webpagetest.org tool to check a web page, this indicates that keep-alive is not activated. I researched this and was led to How can I enable keep-alive? and Changing PHP $_SERVER['HTTP_CONNECTION'] value

Following from this I tried <ifModule mod_headers.c> Header set Connection keep-alive </ifModule> in the .htaccess file. The http://www.webpagetest.org tool still indicated keep-alive is not activated.

I contacted the hosting company and they stated that Keep-Alive is enabled.

I made a bare bones html test file (call this test.html) that sought to load two images, one from the server that did not keep-alive (call this notalive) and the other from a server (call this alive) that the http://www.webpagetest.org tool indicated is keeping alive.

Results:

when checking test.html hosted on server notalive with the webpagetest tool the image on server notalive indicates that keep-alive is not activated, however for the image on server alive the tool indicates that it is keep-alive.

I then swopped the test.html over to server alive and the webpage tool indicated exactly as per the test above that is for the image on notalive server the tool says keep-alive is not activated and for the the image on server alive the tool says keep-alive is activated.

This led me to believe that since the html files are identical that my issue might be due to configuration of the server notalive.

I ran phpinfo() from both servers and retained lines that seemed to do with alive (based on the above stackoverflow postings) and have reproduced those lines below.

For the notalive server:

PHP  Version  5.3.29

Configuration:  apache2handler:  Max  Requests  Per  Child:  500  -  Keep  Alive:  on  -  Max  Per  Connection:  100
Configuration:  apache2handler:Timeouts  Connection:  300  -  Keep-Alive:  1

Apache  Environment:  HTTP_CONNECTION  close

HTTP  Headers  Information:  HTTP  Request  Headers:  connection  close

Connection  keep-alive


PHP  Variables:  _SERVER["HTTP_CONNECTION"]  close

For the alive server:

PHP  Version  5.2.12

apache:  Max  Requests  Per  Child:  1000  -  Keep  Alive:  on  -  Max  Per Connection:  500
Timeouts  Connection:  300  -  Keep-Alive:  5


Apache  Environment:  HTTP_CONNECTION  keep-alive


HTTP  Headers  Information:  HTTP  Request  Headers:  Connection  keep-alive

HTTP  Headers  Information:  HTTP  Response  Headers:
  Keep-Alive  timeout=5,  max=500
  Connection  Keep-Alive

PHP  Variables:  _SERVER["HTTP_CONNECTION"]  keep-alive

I would be most obliged if someone would look at the above and perhaps offer some guidance on how to activate keep-alive.

Thank you for taking the time to read this.

Upvotes: 0

Views: 1495

Answers (1)

user1558796
user1558796

Reputation: 291

Sorted or at least a workaround.

Based on my test results the hosting company have concluded that the issue is due to their use of Apache web server and Varnish Cache.

They have moved the site over to Litespeed Server and the connections are now kept alive.

Thanks Blowski for the assistance.

Upvotes: 1

Related Questions