understanding threads relative to OPEN/BOUND/CONNECTED ... etc
"Trustin Lee (이희승)"
trustin at gmail.com
Thu Jun 3 05:08:53 EDT 2010
Hi Anthony,
You have to use OrderedMemoryAwareThreadPoolExecutor instead. Also, it
seems like your thread pool size is too large?
HTH,
Trustin
anthony_w wrote:
> Hi,
>
> I'm trying to get a handle on understanding how to gauge the peformance,
> throughput, and excessive threading. My client app sends a message to the
> server. The server responds with multiple replies, and on the last reply,
> closes the channel. The client then exits gracefully (as far as I can
> tell).
>
> So I see this in my log. What does "thread-#" mean? The number increases
> with each successive client instance that I run. Am I somehow not cleaning
> up properly, or maybe using the wrong thread pool? I want to make sure I'm
> not leaving idle threads around.
>
>
> INFO [pool-3-thread-1] ............... 127.0.0.1:6789] OPEN
> INFO [pool-3-thread-2] ............... 127.0.0.1:6789] BOUND:
> /127.0.0.1:6789
> INFO [pool-3-thread-3] ............... 127.0.0.1:6789] CONNECTED:
> /127.0.0.1:3249
> INFO [pool-3-thread-4] ............... 127.0.0.1:6789] INTEREST_CHANGED
> INFO [pool-3-thread-6] ............... 127.0.0.1:6789] INTEREST_CHANGED
> INFO [pool-3-thread-30] .............. 127.0.0.1:6789] DISCONNECTED
> INFO [pool-3-thread-31] .............. 127.0.0.1:6789] UNBOUND
> INFO [pool-3-thread-32] .............. 127.0.0.1:6789] CLOSED
>
>
>
> Here is my setup:
>
> bootstrap = new ServerBootstrap(
> new NioServerSocketChannelFactory(
> Executors.newCachedThreadPool(),
> Executors.newCachedThreadPool()));
>
> ExecutionHandler executionHandler = new ExecutionHandler(new
> MemoryAwareThreadPoolExecutor(700, 50, 50));
>
> bootstrap.setPipelineFactory(new
> ServerPipelineFactory(executionHandler));
>
>
>
> Here is my pipeline factory. I omitted the constructor but you can see in
> the line above that it takes in the execution handler:
>
>
> p.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1048576,
> 0, 4, 0, 4));
> p.addLast("protobufDecoder", new
> ProtobufDecoder(PRequestProtocol.Request.getDefaultInstance()));
>
> p.addLast("frameEncoder", new LengthFieldPrepender(4));
> p.addLast("protobufEncoder", new ProtobufEncoder());
>
> p.addLast("executor", this.executionHandler);
>
> p.addLast("handler", new ServerHandler());
>
>
>
> Thanks.
>
> Tony.
>
--
what we call human nature in actuality is human habit
http://gleamynode.net/
More information about the netty-users
mailing list