How to test keep-alive is working on client end

You can use Curl like this:

curl -Iv http://www.aptivate.org 2>&1 | grep -i 'connection #0'

And it outputs these two lines if keep-alive is working:

* Connection #0 to host www.aptivate.org left intact
* Closing connection #0

And if keep-alive is not working, then it just outputs this line:

* Closing connection #0

The output Connection ... left intact proves that the server did not close the connection, and it is available for the client to reuse. It's up to the client to decide whether it actually wants to reuse the connection or not. You can demonstrate it with Curl by listing the same URL twice on the command line

curl -Iv http://www.aptivate.org --next http://www.aptivate.org 2>&1 | grep -i '#0'

in which case it will give output something like:

Re-using existing connection! (#0) with host ...
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

How To: Back Up MySQL Databases From The Command Line

While automated backups are important, sometimes you just want to take a quick and dirty snapshot...

How To Install MariaDB on CentOS 6

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and...

How to Display (List) All Jobs in Cron / Crontab

View Root’s Cron Jobs crontab -l  View a User’s Cron Jobs crontab -u username -l Example with...

How To: Automate Server Scripts With Cron

Servers can automatically perform tasks that you would otherwise have to perform yourself, such...

How to find sending spam emails and enable mail header in php.ini

- In Linux servers if there are a lot of emails in the queue "over 100" emails. you can check if...