Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test persistent connection in a HTTP server?

Tags:

http

While building a small experimental HTTP server, I need to implement the persistent connection feature of HTTP 1.1 (and the pipelining feature). How do I test it? Using a browser like Firefox gives me little or no control, and it's hard to check. Any ideas?

Thanks

like image 534
Nathan H Avatar asked Oct 17 '08 01:10

Nathan H


People also ask

How do I know if my connection is persistent?

The best place to start is in the Headers View. The Headers View will identify both the protocol used, as well as other HTTP Headers being sent back. If you see the header: “Connection: close”, then your site is not using persistent connections.

How do I test HTTP keep-alive?

In order to check if your pages are delivered with a Keep-Alive header, you can use the HTTP Header Checker tool. This will display the Connection: Keep-Alive field if the HTTP Keep-Alive header is enabled.

Does HTTP use persistent connection?

HTTP has a persistent connection function that allows the channel to remain open rather than be closed after a requested exchange of data. TCP is a connection-oriented protocol: It starts a connection after confirmation from both ends that they are available and open to a data exchange.

Is HTTP 2 persistent connection?

As a result, all HTTP/2 connections are persistent, and only one connection per origin is required, which offers numerous performance benefits.

Is HTTP 1.1 persistent or non-persistent?

In HTTP/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to HTTP/1.0).

Which header tells that connection is persistent?

The Connection general header controls whether the network connection stays open after the current transaction finishes. If the value sent is keep-alive , the connection is persistent and not closed, allowing for subsequent requests to the same server to be done.

How long can a HTTP connection last?

In Firefox, the number of simultaneous connections can be customized (per-server, per-proxy, total). Persistent connections time out after 115 seconds (1.92 minutes) of inactivity which is changeable via the configuration.


2 Answers

curl(http://curl.haxx.se/) -- gives you very good control over GET/POST and many other attributes.

curl also comes with libcurl so that you can do things programatically.

Perl and python(urllib or urllib2 ) will help you get there.

like image 140
anjanb Avatar answered Oct 07 '22 21:10

anjanb


ab, or ApacheBench is a commandline benchmark for HTTP servers. The -k option makes it use KeepAlive.

like image 26
Javier Avatar answered Oct 07 '22 21:10

Javier