Reputation: 5660
If we have a HTTP persistent connection, however one of the request takes a long time (say 30 seconds). Assume client's timeout is 15 seconds.
Is client's reques-timeout respected when used over persistent connection ?
If yes, then does the connection break ?
Is there any way to avoid the entire connection from breaking, and instead just timing out on that one particular request ?
Upvotes: 2
Views: 1324
Reputation: 12045
That depends of what client you are using and how the server is configured. The problem is more complicated... setting keep-alive
in http
won't avoid tcp
timeouts at transport level, you need to set tcp
timeout to keep-alive
as well, but then server may not want to keep a connection for you as long as you would like to. For persistent connections it is better to use udp
instead of tcp
- it doesn't have such a strict flow control. Other thing is that HTTP/2
has no such a thing as keep-alive
at all, as things are handled in totally different way than in HTTP/1
. From the HTTP/2 RFC:
8.1.2.2. Connection-Specific Header Fields
HTTP/2 does not use the Connection header field to indicate
connection-specific header fields; in this protocol, connection-
specific metadata is conveyed by other means. An endpoint MUST NOT
generate an HTTP/2 message containing connection-specific header
fields; any message containing connection-specific header fields MUST be treated as malformed (Section 8.1.2.6).The only exception to this is the TE header field, which MAY be
present in an HTTP/2 request; when it is, it MUST NOT contain any
value other than "trailers".This means that an intermediary transforming an HTTP/1.x message to HTTP/2 will need to remove any header fields nominated by the
Connection header field, along with the Connection header field
itself. Such intermediaries SHOULD also remove other connection-
specific header fields, such as Keep-Alive, Proxy-Connection,
Transfer-Encoding, and Upgrade, even if they are not nominated by the Connection header field.
Upvotes: 0
Reputation: 1509
Upvotes: 1