HttpServer example blocking after 16384 requests

"이희승 (Trustin Lee)" trustin at gmail.com
Fri Jun 26 21:42:13 EDT 2009


Hi Sebastian,

I guess the client ran out of ports due to TIME_WAIT state.  Try to see 
how many ports are taken by TIME_WAIT state - 'netstat -nat' in Linux. 
The client will continue its work when TIME_WAIT state goes away.  To 
avoid this problem, you could

1) increase the ephemeral port range
    http://en.wikipedia.org/wiki/Ephemeral_port
    http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html

2) turn on 'tcp_tw_recycle' in Linux
    http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html#AEN499

3) Use Keep-Alive

HTH,
Trustin

Sebastian Latza wrote:
> Hi everybody,
>
> I am toying around with the netty examples and ran into an issue with
> the HttpServer. After 16384 requests (16 KB) from Apache Bench my server
> stops accepting new requests for a while. After 30 sec. or so it
> "recovers", taking another 16384. I'm guessing that the threads are not
> releasing the sockets properly for some reason, but I'm not sure how to
> enforce this. Another reason could be os-related, but again I am not
> sure which parameter to tune (max . files are 256) I'm running Mac OS,
> 2GB Ram, Java 1.5.0_19, Netty 3.10.CR1
>
> Any hints/pointers?
>
> Regards
> Sebastian


-- 
Trustin Lee, http://gleamynode.net




More information about the netty-users mailing list