hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Gl├╝ck <...@odi.ch>
Subject Re: Keep-alive connection close on JBoss 4.2.2
Date Tue, 06 May 2008 18:19:36 GMT
Asankha C. Perera wrote:
> Hi all
> When using the Apache Synapse HTTP transport built over HttpCore+NIO 
> with JBoss 4.2.2 based Web service,

JBoss embeds Tomcat as its servlet container. So this is probably controlled by 
the connection pool settings of Tomcat.

 > I can see that typically JBoss
> terminates a keep-alive connection after 20 seconds, but when under 
> load, it closes some connections (about 1 or 2 per 100) in around 4ms or 
> 5ms etc..

Makes sense to reduce resource consumption under load, doesn't it?

> When using HTTP 1.1, is the server expected to adhere to any 
> "Keep-Alive: xxx" headers sent by a client? i.e. Can I ask the server to 
> not close keep alive connections pre-maturely and can I expect adherence 
> from any server?

Of course not. The client can politely ask, but the server makes the final 
decision. See RFC 2616, section

> If the remote party does close a keep-alive session due to an internal 
> decision, while the remote client is still reading the response, is this 
> still valid from the server point of view? i.e. as soon as the server is 
> done writing its response to the socket, can it close the TCP connection?

Well, TCP packets have a sequence number. And the FIN will certainly come after 
all the data packets (provided the server is coded properly and does flush the 
socket buffers before close, and it doesn't do a RST instead). No worries here. 
Even when the sender has already closed the socket, the TCP stack will make sure 
that the packets on the wire will be transferred correctly (resend etc).

Anyway the server closing his side of the connection doesn't even affect the 
client side of the connection. It causes a half-open TCP connection (which can 
actually be reopened in theory by sending another SYN). That's why the client 
must always close its side of the connection as well or it causes a fd leak. The 
server should generally announce its decision to close the connection with a 
Connection: close header.

> thanks
> asankha



To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message