TimeoutHandlers consume too many resources (bug)

Dave Siracusa dave.siracusa at yellowbook.com
Mon Feb 9 14:57:12 EST 2009


I now construct the timer in main and pass it in (below).  Performance and
resource consumption is good now.  I will continue to test.

public class HttpServerPipelineFactory implements ChannelPipelineFactory {
    static final InternalLogger logger =
InternalLoggerFactory.getInstance(HttpRequestHandler.class);

    private final Timer timer;

    public HttpServerPipelineFactory(Timer timer) {
        this.timer = timer;
    }

    public ChannelPipeline getPipeline() throws Exception {
        // Create a default pipeline implementation.
        ChannelPipeline pipeline = pipeline();
        pipeline.addLast("readTimeout", new ReadTimeoutHandler(timer, 10,
TimeUnit.SECONDS));
        pipeline.addLast("writeTimeout", new WriteTimeoutHandler(timer, 10,
TimeUnit.SECONDS));
        pipeline.addLast("decoder", new HttpRequestDecoder());
        pipeline.addLast("encoder", new HttpResponseEncoder());
        pipeline.addLast("handler", new HttpRequestHandler());
        return pipeline;
    }
}


Dave Siracusa wrote:
> 
> I integrated timeout handlers in my server.  I exercise my server via
> jmeter using 10 threads, 10 iterations.  After several runs, I noticed
> that the server responsiveness goes way down from 6KB/sec to <1kB/sec.
> 
> I inspected the java process in Windows 2003 Server taskmanager and found
> the handle count in excess of 16k, memory at 120MB, CPU utilization > 90%
> even after my tests were completed.  I brought down process explorer from
> sysinternals.com and inspected the native java process and noticed
> thousands of native windows threads.  
> I receive no timeout exceptions during the tests.
> 
> I repeated the tests with the ReadTimeoutHandler and WriteTimeoutHandler
> commented out and the thread count is 100-125, memory is 25MB, and CPU at
> 0% minutes after the test.
> The performance is faster than with the handlers and stays consistent from
> run to run.
> 
> This appears to be a bug, however my code is based on other posts which
> constructs a new HashedWheelTimer in the ChannelPipeline.  If I understand
> it, this doesn't seem optimal.  I will construct the HashedWheelTimer and
> pass it into ChannelPipeline in main and repost my results.
> 
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/TimeoutHandlers-consume-too-many-resources-%28bug%29-tp2298966p2299076.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list