Questions tagged [keep-alive]

A feature of HTTP where the same connection is used for multiple requests, speeding up downloading of web pages with multiple resources.

834 questions
107
votes
1 answer

Keep-alive header clarification

I was asked to build a site , and one of the co-developer told me That I would need to include the keep-alive header. Well I read alot about it and still I have questions. msdn -> The open connection improves performance when a client makes…
Royi Namir
  • 131,490
  • 121
  • 408
  • 714
94
votes
4 answers

http keep-alive in the modern age

So according to the haproxy author, who knows a thing or two about http: Keep-alive was invented to reduce CPU usage on servers when CPUs were 100 times slower. But what is not said is that persistent connections consume a lot of memory…
Michael Neale
  • 18,590
  • 18
  • 72
  • 106
90
votes
8 answers

Does a TCP socket connection have a "keep alive"?

I have heard of HTTP keep-alive but for now I want to open a socket connection with a remote server. Now will this socket connection remain open forever or is there a timeout limit associated with it similar to HTTP keep-alive?
Kevin Boyd
  • 11,251
  • 24
  • 80
  • 125
83
votes
4 answers

WebSockets ping/pong, why not TCP keepalive?

WebSockets have the option of sending pings to the other end, where the other end is supposed to respond with a pong. Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in response, unless it already received a Close frame. It…
Thomas
  • 150,847
  • 41
  • 308
  • 421
62
votes
4 answers

Persistent/keepalive HTTP with the PHP Curl library?

I'm using a simple PHP library to add documents to a SOLR index, via HTTP. There are 3 servers involved, currently: The PHP box running the indexing job A database box holding the data being indexed The solr box. At 80 documents/sec (out of 1…
Frank Farmer
  • 35,103
  • 11
  • 67
  • 86
58
votes
10 answers

How do I shutdown a Node.js http(s) server immediately?

I have a Node.js application that contains an http(s) server. In a specific case, I need to shutdown this server programmatically. What I am currently doing is calling its close() function, but this does not help, as it waits for any kept alive…
Golo Roden
  • 112,924
  • 78
  • 260
  • 376
54
votes
3 answers

How does Keep-alive work with ThreadPoolExecutor?

In continuation to a question posted by me, I'm trying to use ThreadPoolExecutor in my codebase. Even after repeated attempts to comprehend from Java API doc, I failed to understand clearly the functionality/purpose behind keepAliveTime parameter…
Gnanam
  • 9,553
  • 18
  • 48
  • 71
42
votes
7 answers

Python urllib2 with keep alive

How can I make a "keep alive" HTTP request using Python's urllib2?
ibz
  • 38,044
  • 21
  • 65
  • 83
41
votes
2 answers

HTTP keep-alive timeout

Can I specify the HTTP timeout or does the server impose a value? For example, if I do: telnet my.server.net 80 Trying X.X.X.X... Connected to my.server.net. Escape character is '^]'. GET /homepage.html HTTP/1.0 Connection: keep-alive Host:…
Ricky Robinson
  • 17,881
  • 35
  • 113
  • 172
41
votes
2 answers

How to set the HTTP Keep-Alive timeout in a nodejs server

I'm actually doing some load testing against an ExpressJS server, and I noticed that the response send by the server includes a "Connection: Keep-Alive" header. As far as I understand it, the connection will remain opened until the server or the…
Miguel L.
  • 608
  • 2
  • 6
  • 11
36
votes
6 answers

How to keep an iPhone app running on background fully operational

first of all, I know there is only support for voip, audio and location apps to run in background and that they will run just while the audio is been played or while using location services, etc. What I want to know is if there is a way to keep my…
Paul N
  • 1,881
  • 1
  • 22
  • 32
35
votes
2 answers

How to change tcp keepalive timer using python script?

In my python script, I have activate TCP Keepalive using this command: x = s.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) My goal is for socket connection to get closed, if there is no transmission(*) for 5 minutes. I am working on…
John
  • 351
  • 1
  • 3
  • 4
33
votes
7 answers

Simple comet example using php and jquery

Can anyone give me a good and simple example of the comet technique using PHP? I just need an example that uses a persistent HTTP connection or something similar. I don't want to use a polling technique, because I have something like that set up…
Ray
32
votes
6 answers

How can I enable keep-alive?

I ran a Google Page Speed and it says I scored 57/100 because I need to "Enable Keep-Alive" and "Enable Compression". I did some Google searches but I can't find anything. I even contacted my domain provider and asked them to turn it on, but they…
John Doe
  • 3,239
  • 13
  • 57
  • 107
31
votes
8 answers

HttpsUrlConnection and keep-alive

I am using com.sun.net.httpserver.HttpsServer in my current project which deals with client-authentification etc.. Currently it only prints out the clients address/port, so that I can check if one TCP-connection is used for multiple requests…
Biggie
  • 6,647
  • 10
  • 30
  • 39
1
2 3
55 56