Hi Rob,

On 6/8/07, Rob Butler <[EMAIL PROTECTED]> wrote:
Hey Trustin,

I'm building a server that must handle lots of UDP traffic.  By it's very 
nature the connections are not kept open and I call session.close() after 
servicing each one.  The server will also have a good number of TCP clients 
with the same traffic pattern.  (connect-request-response-close).  What kind of 
problem are you talking about below?  How can I work around the issue to keep 
my server running well?  I'm not to the point where I can load test my server, 
but if this is a known problem I'd like to prevent it from the outset.

UDP is fine because it's connectionless.  Closing a TCP connection
very frequently can decrease the performance of the network
application because the closing side will have many TIME_WAIT state.
That's why many protocols provide keep-alive mode that allows you send
multiple requests with one connection.  Usual work around to this
issue are:

1) Support keep-alive mode
2) Client closes the connection.  Server closes connection only when
client doesn't close the connection for certain amount of time using
sessionIdle event.  TIME_WAIT state will be left in the client side
instead of the server side, so the number of TIME_WAIT state will be
distributed over many clients.  But this won't work if the client
sends excessive number of requests within a short period.
3) Configure the TIME_WAIT timeout parameter of the operating system.
It's somewhat cumbersome in some operating systems such as Linux
because you need to compile the kernel again.  It is known to be easy
to modify in Windows though.

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to