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.

892 questions
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,559
  • 15
  • 62
  • 111
32
votes
3 answers

Relation between HTTP Keep Alive duration and TCP timeout duration

I am trying to understand the relation between TCP/IP and HTTP timeout values. Are these two timeout values different or same? Most Web servers allow users to set the HTTP Keep Alive timeout value through some configuration. How is this value used…
Suresh Kumar
  • 11,241
  • 9
  • 44
  • 54
25
votes
2 answers

Does WebClient use KeepAlive?

I need to issue around 50 HTTP requests to a single host (API calls). Performance is important, so I'd like to use HTTP KeepAlive's. Does WebClient support this?
Vilx-
  • 104,512
  • 87
  • 279
  • 422
24
votes
1 answer

Difference between NodeJS new Agent() and HTTP Keep-Alive header..?

I'm using axios to make HTTP requests. axios offers the option to specify new http.Agent() in the request config when used in Node. The http Agent options are: const agentOptions = { keepAlive: true, // Keep sockets around even when there are…
Stephen Last
  • 5,491
  • 9
  • 44
  • 85
24
votes
2 answers

Express.js close response

Is there a way to close a response? I can use res.end() but it doesn't actually close the socket. What I want to achieve: I am writing a Java program which interfaces with the network, and I am writing a NodeJS server for this. Java code: String…
Matej
  • 9,548
  • 8
  • 49
  • 66
23
votes
4 answers

How to use SO_KEEPALIVE option properly to detect that the client at the other end is down?

I was trying to learn the usage of option SO_KEEPALIVE in socket programming in C language under Linux environment. I created a server socket and used my browser to connect to it. It was successful and I was able to read the GET request, but I got…
Durin
  • 2,070
  • 5
  • 23
  • 37
23
votes
1 answer

How do browsers handle HTTP keepalive race condition?

There exists a known race condition in the HTTP keepalive mechanism: HTTP KeepAlive connection closed by server but client had sent a request in the mean time https://github.com/mikem23/keepalive-race As I understand, I need my HTTP client either…
speller
  • 1,641
  • 2
  • 20
  • 27
22
votes
1 answer

When to use httpclose or http-server-close in haproxy

I have inherited a system where it has some performance issues due to network latency. We are using CentOS 5.x, and haproxy 1.5x The reason is that there is a lot of time spent on each API requests due to time spent on "initial connection" Ignore…
forestclown
  • 1,582
  • 4
  • 25
  • 39
20
votes
1 answer

Overhead of Idle WebSockets

Say I have an websocket that may receive an event at any time, but is mostly idle, how much bandwidth will be consumed after the initial connection in order to keep it alive? For what it's worth, the server is NodeJS using ws, and the client is…
Jacob
  • 1,335
  • 1
  • 14
  • 28
20
votes
3 answers

JSch: How to keep the session alive and up

I'm writing Java GUI program for static route management using SSH. My code is as follows: import com.jcraft.jsch.*; import java.io.*; public class Konsep { String status; static String username; static String hostname; String…
user2277956
  • 201
  • 1
  • 2
  • 3
19
votes
4 answers

Tomcat, HTTP Keep-Alive and Java's HttpsUrlConnection

I have two Tomcat servers that need to maintain a persistent connection to cut down on SSL handshaking. One server (the proxy) sits in a DMZ while the other one is safely behind another firewall. The proxy basically just runs a simple servlet that…
James Sheppard
  • 301
  • 1
  • 4
  • 15
19
votes
1 answer

Why is Connection: keep-alive still being specified in http headers (isn't it deprecated)?

According to "HTTP: The Definitive Guide", using Connection: keep-alive to specify a persistent connection is deprecated in HTTP/1.1, since HTTP/1.1 specifies that connections are persistent by default and must be closed manually by sending…
capdigi
  • 203
  • 1
  • 2
  • 5
19
votes
1 answer

Proper use of KeepAlive in Apache Htaccess

What is the difference between: Header set Connection keep-alive and KeepAlive on in Apache htaccess? What code and options we have to put in the header of a php file? And what in htaccess file?
Sam
  • 15,254
  • 25
  • 90
  • 145
18
votes
2 answers

How to make Flask/ keep Ajax HTTP connection alive?

I have a jQuery Ajax call, like so: $("#tags").keyup(function(event) { $.ajax({url: "/terms", type: "POST", contentType: "application/json", data: JSON.stringify({"prefix": $("#tags").val() }), dataType:…
Bittrance
  • 2,202
  • 2
  • 20
  • 29
1
2
3
59 60