store client specific information

Trustin Lee tlee at redhat.com
Fri Feb 13 08:00:50 EST 2009


Pete,

A single OrderedMemoryAwareThreadPoolExecutor instance should be
shared by more than one pipeline.  If
ChannelPipelineFactory.getPipeline() creates a new
OrederedMemoryAwareThreadPoolExecutor, it means each connection will
have its own thread pool and it does not make sense.  You should at
least do the following:

  public class MyPipelineFactory implements ChannelPipelineFactory {
    private final ExecutionHandler executionHandler = new
ExecutionHandler(new OrderedMemoryAwareThreadPool(...));

    public ChannelPipeline getPipeline() {
      ChannelPipeline p = Channels.pipeline();
      p.addLast("execution", executionHandler);  // Use one instance
again and again
      ...
      return p;
    }
  }

HTH,

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



On Fri, Feb 13, 2009 at 4:58 AM, miarkus <miarkus at tlen.pl> wrote:
>
> Hello again,
>
> I figured out that removing OrderedMemoryAwareThreadPoolExecutor from
> PipelineFactory solves the problem.
>
> Before:
> 100 connections -> 1000 threads running
>
> After:
> 2000 connections -> 6 threads running
>
> Question:
>
> I need to incorporate ExecutionHandler into PipelineFactory because I'm
> querying mysql with each client connection. What are the possibilities in
> this situation?
> --
> View this message in context: http://n2.nabble.com/store-client-specific-information-tp2176934p2317204.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>




More information about the netty-users mailing list