The proper way to do this with Netty 4 is to use a io.netty.util.concurrent.DefaultEventExecutorGroup. Here's an example of how to execute a handler using an Executor. In that code segment, eventExecutor is an implementation of io.netty.util.concurrent.DefaultEventExecutorGroup.
pipeline.addLast(eventExecutor, "dispatcher", new HttpDispatcher()); On Mon, Aug 3, 2015 at 10:43 AM, Kasun Indrasiri <[email protected]> wrote: > They recommend not to block the EventLoop thread under any circumstances > [1]. So, the application level logic (mediation/services) needs to be > handled from a separate thread pool. > > > [1] > http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#23.0 > > > On Thu, Jul 30, 2015 at 11:42 PM, Isuru Ranawaka <[email protected]> wrote: > >> Hi all, >> >> I think there are two aspects, handling connections and handling >> requests coming through connections. Basically what happens is Threads in >> BossGroup accepts the incoming connections and after accepting it. It >> creates a channel pipelines for each connection and handover accepted >> connections to handle by netty worker threads. >> So here after IO operations are handle by worker threads. each worker is >> responsible for handling its pipeline. Requests are coming through that >> pipe line and through netty handlers we can access those requests . If we >> use same Netty worker IO thread for handle requests then if one requests >> takes long processing time then following requests also affected from that >> which applies back pressure on IO Threads. So I think we need to handle >> incoming requests from separate threads to run netty worker threads >> smoothly. For Netty 4 on wards they have mentioned that we can share same >> worker pool for boss and worker groups as well. >> >> thanks >> IsuruR >> >> >> On Thu, Jul 30, 2015 at 4:14 AM, Ravi Undupitiya <[email protected]> wrote: >> >>> Netty 5.x is still in alpha and 4.x is current stable. >>> >>> On Thu, Jul 30, 2015 at 2:32 PM, Afkham Azeez <[email protected]> wrote: >>> >>>> Shouldn't we be using Netty 5? >>>> >>>> On Thu, Jul 30, 2015 at 2:26 PM, Ravi Undupitiya <[email protected]> wrote: >>>> >>>>> Hi Azeez, >>>>> >>>>> The reason for using a worker for executing engine tasks is to avoid >>>>> using an I/O thread to do the same. AFAIU the pipeline is executed from an >>>>> I/O thread. However, we might be able to share the existing netty worker >>>>> pool [1] and place our worker in it. We'll update the code to use this. >>>>> >>>>> >>>>> [1] >>>>> http://netty.io/4.0/api/io/netty/channel/ChannelHandlerContext.html#executor() >>>>> >>>>> >>>>> Thanks, >>>>> Ravi >>>>> >>>>> On Thu, Jul 30, 2015 at 10:02 AM, Afkham Azeez <[email protected]> wrote: >>>>> >>>>>> I was going through the code, and in addition to the Netty boss & >>>>>> worker pools, we have our own worker pool. Why is that? Looks like a >>>>>> remnant from the old PT architecture but do we really need that? >>>>>> >>>>>> Regards >>>>>> Azeez >>>>>> >>>>>> -- >>>>>> *Afkham Azeez* >>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>>>> Member; Apache Software Foundation; http://www.apache.org/ >>>>>> * <http://www.apache.org/>* >>>>>> *email: **[email protected]* <[email protected]> >>>>>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * >>>>>> *http://blog.afkham.org* <http://blog.afkham.org> >>>>>> *twitter: **http://twitter.com/afkham_azeez* >>>>>> <http://twitter.com/afkham_azeez> >>>>>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez >>>>>> <http://lk.linkedin.com/in/afkhamazeez>* >>>>>> >>>>>> *Lean . Enterprise . Middleware* >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> *Ravi Undupitiya* >>>>> Senior Software Engineer; WSO2 http://wso2.com >>>>> >>>>> >>>>> *E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712 >>>>> <%2B94%C2%A0772%20930%20712>* >>>>> >>>>> Lean . Enterprise . Middleware >>>>> >>>> >>>> >>>> >>>> -- >>>> *Afkham Azeez* >>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>> Member; Apache Software Foundation; http://www.apache.org/ >>>> * <http://www.apache.org/>* >>>> *email: **[email protected]* <[email protected]> >>>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * >>>> *http://blog.afkham.org* <http://blog.afkham.org> >>>> *twitter: **http://twitter.com/afkham_azeez* >>>> <http://twitter.com/afkham_azeez> >>>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez >>>> <http://lk.linkedin.com/in/afkhamazeez>* >>>> >>>> *Lean . Enterprise . Middleware* >>>> >>> >>> >>> >>> -- >>> *Ravi Undupitiya* >>> Senior Software Engineer; WSO2 http://wso2.com >>> >>> >>> *E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712 >>> <%2B94%C2%A0772%20930%20712>* >>> >>> Lean . Enterprise . Middleware >>> >>> _______________________________________________ >>> Architecture mailing list >>> [email protected] >>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>> >>> >> >> >> -- >> Best Regards >> Isuru Ranawaka >> M: +94714629880 >> Blog : http://isurur.blogspot.com/ >> >> _______________________________________________ >> Architecture mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >> >> > > > -- > Kasun Indrasiri > Software Architect > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > cell: +94 77 556 5206 > Blog : http://kasunpanorama.blogspot.com/ > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>* *email: **[email protected]* <[email protected]> * cell: +94 77 3320919blog: **http://blog.afkham.org* <http://blog.afkham.org> *twitter: **http://twitter.com/afkham_azeez* <http://twitter.com/afkham_azeez> *linked-in: **http://lk.linkedin.com/in/afkhamazeez <http://lk.linkedin.com/in/afkhamazeez>* *Lean . Enterprise . Middleware*
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
