Threads & New Connections
Trustin Lee
trustin at gmail.com
Thu Oct 20 17:21:46 EDT 2011
If there is no open connection assigned to a worker thread, the thread will be returned to the thread pool after a while. Sometimes, when a worker thread is being returned to the pool and another thread is being pulled again because of a new connection, the number of the threads borrowed from the pool will exceed the maximum number of worker threads. However, this happens only briefly, and that's why you have to use newCachedThreadPool(). If you specified the number of worker threads as 4 and specified a fixed thread pool with 4 threads, it will be locked up because sometimes Netty will need 5 threads, although it never means I/O will take place in more than 4 threads.
--
Trustin Lee
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Thursday, October 20, 2011 at 7:08 AM, Norman Maurer wrote:
> Maybe I don't remember correctly. I will have a deeper look again.
>
> Thanks,
> Norman
>
> Am Donnerstag, 20. Oktober 2011 schrieb Bill Burke <bburke at redhat.com (mailto:bburke at redhat.com)>:
> > I don't think you are right. I've been looking at the NIO code deeply
> > the past few days and the set of workers is a fixed array[]. The accept
> > thread does a register on a round-robin-picked worker. If the worker is
> > already started, then the accepted socket is added to the worker's
> > selector. If the worker isn't started, then it gets added to the worker
> > Executor.
> >
> > OiO is different though and *does* do a thread-per-connection.
> >
> > On 10/20/11 9:36 AM, Norman Maurer wrote:
> >> Hi Bill,
> >>
> >> the "max" cocurrent io threads are limited thats right. But it may
> >> spin a new thread for some reasons before one can get destroyed or put
> >> back..
> >>
> >> See also:
> >> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Help-with-limiting-number-of-possible-channels-td6464491.html#none
> >>
> >> Bye,
> >> Norman
> >>
> >> Ps: I think its also somewhere explained in the javadocs but I don't
> >> know where atm
> >>
> >> 2011/10/20 Bill Burke<bburke at redhat.com (mailto:bburke at redhat.com)>:
> >>> Isn't the amount of workers fixed at bootstrap (at least for NIO)?
> >>>
> >>> On 10/20/11 3:46 AM, ljohnston wrote:
> >>>> Hi Irwin
> >>>>
> >>>> Those threads seem to come from the Eclipse runtime. Assuming your code
> >>>> isn't some sort of Eclipse plugin can you run it outside of eclipse and see
> >>>> if the behaviour changes? Otherwise it looks like something is spawning
> >>>> Eclipse jobs and Eclipse isn't releasing the threads.
> >>>>
> >>>> Cheers
> >>>> Lee
> >>>>
> >>>>
> >>>> --
> >>>> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6911955.html
> >>>> Sent from the Netty User Group mailing list archive at Nabble.com (http://Nabble.com).
> >>>> _______________________________________________
> >>>> netty-users mailing list
> >>>> netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> >>>> https://lists.jboss.org/mailman/listinfo/netty-users
> >>>
> >>> --
> >>> Bill Burke
> >>> JBoss, a division of Red Hat
> >>> http://bill.burkecentral.com
> >>> _______________________________________________
> >>> netty-users mailing list
> >>> netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> >>> https://lists.jboss.org/mailman/listinfo/netty-users
> >>>
> >> _______________________________________________
> >> netty-users mailing list
> >> netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> >> https://lists.jboss.org/mailman/listinfo/netty-users
> >
> > --
> > Bill Burke
> > JBoss, a division of Red Hat
> > http://bill.burkecentral.com
> > _______________________________________________
> > netty-users mailing list
> > netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> > https://lists.jboss.org/mailman/listinfo/netty-users
> >
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> https://lists.jboss.org/mailman/listinfo/netty-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20111020/61fe896a/attachment.html
More information about the netty-users
mailing list