On 06/12/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Sebastian,
>
> shooting from the hip...
>
> The TIME_WAIT state indicates that the connection
> was orderly closed. If a connection (of HttpClient)
> remains open when the JVM exits, it is force-closed
> by a reset and does not enter the TIME_WAIT state.

I was wondering about that myself.

> > Example 4: http://www.google.com/ auto-redirect=true, keep-alive=true
> > [Redirects to www.google.co.uk]
> >
> > HttpClient leaves a connection to www.google.com in TIME_WAIT
> > Java leaves connections to both www.google.com and www.google.co.uk in
> > TIME_WAIT
>
> HttpClient connects to www.google.com and receives
> a redirect. The method director returns the open
> connection to the SimpleHttpConnectionManager, which
> consumes the response body. The socket is kept open
> until the method director obtains the connection for
> the redirect. Then it is orderly closed, bringing it
> into TIME_WAIT state. A new socket is used to read
> from www.google.co.uk. Because of the keep-alive,
> that socket remains open until the JVM exits.
>
> Explaining the behavior of Java HTTP is a bit
> trickier. Either their keep-alive strategy closes
> sockets that HttpClient keeps open, or they use
> a shutdown hook to orderly close connections when
> the JVM exits.

If HttpClient (or my app) is failing to close sockets at the end,
perhaps it needs to be enhanced - otherwise it will be causing the
server to go into TIME_WAIT instead?

AIUI, one end or the other must go through TIME_WAIT; normally it is
better for the client to do so.

> Does that make sense? It might play a role whether
> the connection is closed by the client (HttpClient+
> redirect) or by the server ("connection: close" in
> the request you send).

It does make sense.

Perhaps I should try another test where the application does not exit
immediately, to see what state the connections are in.

> You may want to use MultiThreadedHttpConnectionManager
> to get results that are better comparable.

Could try that. But we don't want to use that for JMeter.

> hope that helps,

Thanks.

By the way, files and output are in

http://people.apache.org/~sebb/time_wait/

comauto - google.com autoredir
comnoauto - google.com no auto redir
coukauto - google.co.uk autoredir

.out = system.out
.err = system.err (trace)

>  Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to