You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <ch...@gmail.com> on 2016/01/13 18:08:52 UTC

Issue with maximumPoolSize & Netty4-http component

Hi,

When I debug this unit test
https://gist.github.com/cmoulliard/123261f7ac2a9d5c719c, the Camel Netty4
HTTP Endpoint is well created with the param "maximumPoolSize=2"

main TRACE [org.apache.camel.impl.DefaultComponent] - Creating endpoint
uri=[netty4-http://http://localhost:26025/echo?maximumPoolSize=2], path=[
http://localhost:26025/echo], parameters=[{maximumPoolSize=2}]

but the number of threads reported by Netty is still bigger than 2

Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
Camel (camel-1) thread #1 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #1 - NettyEventExecutorGroup
Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup

Do I have to use another param to set the ThreadPool used by Netty4-http ?


Regards,

-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Issue with maximumPoolSize & Netty4-http component

Posted by Willem Jiang <wi...@gmail.com>.
Hi Charles,

I just created a JIRA[1] for it and will back port the patch CAMEL-8031 to camel-netty4 shortly.

[1]https://issues.apache.org/jira/browse/CAMEL-9514 

--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 14, 2016 at 3:43:27 PM, Charles Moulliard (ch007m@gmail.com) wrote:
> The workaround only work for the netty4-http but not when we use it with
> the Rest DSL
>  
> This syntax
>  
> @Override
> public void configure() throws Exception {
> // configure to use netty4-http on localhost with the given
> port
> restConfiguration()
> .component("netty4-http")
> .host("localhost").port(getPort())
> .endpointProperty("nettyHttpBinding", "#mybinding")
> .componentProperty("maximumPoolSize","2");
>  
> // use the rest DSL to define the rest services
> rest("/users/")
> .get("{id}/basic")
> .route()
> .log(">> Thread name : ${threadName}")
>  
> will continue to use 16 Threads when we send concurrently 20 messages
>  
> On Thu, Jan 14, 2016 at 8:26 AM, Charles Moulliard wrote:
>  
> > Hi Willem,
> >
> > Thx for your input. I have fixed my problem by setting the parameter on
> > the component itself
> >
> > public void configure() throws Exception {
> >
> > NettyHttpConfiguration nettyConfig = new
> > NettyHttpConfiguration();
> > nettyConfig.setMaximumPoolSize(2);
> > NettyHttpComponent nettyHttp = new NettyHttpComponent();
> > nettyHttp.setConfiguration(nettyConfig);
> >
> > getContext().addComponent("netty4-http", nettyHttp);
> > nettyHttp.start();
> >
> > // expose a echo service
> > from("netty4-http:http://localhost:{{port}}/echo")
> > .log(">> Thread name : ${threadName}")
> >
> > .transform(body().append(body())).to("mock:result");
> > }
> >
> > Only 2 threads are created now
> >
> > Regards,
> >
> > Charles
> >
> > On Thu, Jan 14, 2016 at 2:33 AM, Willem Jiang  
> > wrote:
> >
> >> Hi Charles,
> >>
> >> You should be able to setup the maximumPoolSize on the Netty4-http
> >> component level due to CAMEL-8031[1].
> >> And the maximumPoolSize only works for consumer side.
> >>
> >> [1]https://issues.apache.org/jira/browse/CAMEL-8031
> >>
> >> --
> >> Willem Jiang
> >>
> >>
> >> Blog: http://willemjiang.blogspot.com (English)
> >> http://jnn.iteye.com (Chinese)
> >> Twitter: willemjiang
> >> Weibo: 姜宁willem
> >>
> >>
> >>
> >> On January 14, 2016 at 1:09:04 AM, Charles Moulliard (ch007m@gmail.com)
> >> wrote:
> >> > Hi,
> >> >
> >> > When I debug this unit test
> >> > https://gist.github.com/cmoulliard/123261f7ac2a9d5c719c, the Camel
> >> Netty4
> >> > HTTP Endpoint is well created with the param "maximumPoolSize=2"
> >> >
> >> > main TRACE [org.apache.camel.impl.DefaultComponent] - Creating endpoint
> >> > uri=[netty4-http://http://localhost:26025/echo?maximumPoolSize=2],
> >> path=[
> >> > http://localhost:26025/echo], parameters=[{maximumPoolSize=2}]
> >> >
> >> > but the number of threads reported by Netty is still bigger than 2
> >> >
> >> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #1 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #1 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> >> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> >> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
> >> >
> >> > Do I have to use another param to set the ThreadPool used by
> >> Netty4-http ?
> >> >
> >> >
> >> > Regards,
> >> >
> >> > --
> >> > Charles Moulliard
> >> > Apache Committer & PMC / Architect @RedHat
> >> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> >> >
> >>
> >>
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer & PMC / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> >
> >
>  
>  
> --
> Charles Moulliard
> Apache Committer & PMC / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>  


Re: Issue with maximumPoolSize & Netty4-http component

Posted by Charles Moulliard <ch...@gmail.com>.
The workaround only work for the netty4-http but not when we use it with
the Rest DSL

This syntax

            @Override
            public void configure() throws Exception {
                // configure to use netty4-http on localhost with the given
port
                restConfiguration()
                     .component("netty4-http")
                     .host("localhost").port(getPort())
                     .endpointProperty("nettyHttpBinding", "#mybinding")
                     .componentProperty("maximumPoolSize","2");

                // use the rest DSL to define the rest services
                rest("/users/")
                        .get("{id}/basic")
                        .route()
                        .log(">> Thread name : ${threadName}")

will continue to use 16 Threads when we send concurrently 20 messages

On Thu, Jan 14, 2016 at 8:26 AM, Charles Moulliard <ch...@gmail.com> wrote:

> Hi Willem,
>
> Thx for your input. I have fixed my problem by setting the parameter on
> the component itself
>
>             public void configure() throws Exception {
>
>                 NettyHttpConfiguration nettyConfig = new
> NettyHttpConfiguration();
>                 nettyConfig.setMaximumPoolSize(2);
>                 NettyHttpComponent nettyHttp = new NettyHttpComponent();
>                 nettyHttp.setConfiguration(nettyConfig);
>
>                 getContext().addComponent("netty4-http", nettyHttp);
>                 nettyHttp.start();
>
>                 // expose a echo service
>                 from("netty4-http:http://localhost:{{port}}/echo")
>                         .log(">> Thread name : ${threadName}")
>
> .transform(body().append(body())).to("mock:result");
>             }
>
> Only 2 threads are created now
>
> Regards,
>
> Charles
>
> On Thu, Jan 14, 2016 at 2:33 AM, Willem Jiang <wi...@gmail.com>
> wrote:
>
>> Hi Charles,
>>
>> You should be able to setup the maximumPoolSize on the Netty4-http
>> component level due to CAMEL-8031[1].
>> And the maximumPoolSize only works for consumer side.
>>
>> [1]https://issues.apache.org/jira/browse/CAMEL-8031
>>
>> --
>> Willem Jiang
>>
>>
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.iteye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>>
>>
>> On January 14, 2016 at 1:09:04 AM, Charles Moulliard (ch007m@gmail.com)
>> wrote:
>> > Hi,
>> >
>> > When I debug this unit test
>> > https://gist.github.com/cmoulliard/123261f7ac2a9d5c719c, the Camel
>> Netty4
>> > HTTP Endpoint is well created with the param "maximumPoolSize=2"
>> >
>> > main TRACE [org.apache.camel.impl.DefaultComponent] - Creating endpoint
>> > uri=[netty4-http://http://localhost:26025/echo?maximumPoolSize=2],
>> path=[
>> > http://localhost:26025/echo], parameters=[{maximumPoolSize=2}]
>> >
>> > but the number of threads reported by Netty is still bigger than 2
>> >
>> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #1 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #1 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
>> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
>> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
>> >
>> > Do I have to use another param to set the ThreadPool used by
>> Netty4-http ?
>> >
>> >
>> > Regards,
>> >
>> > --
>> > Charles Moulliard
>> > Apache Committer & PMC / Architect @RedHat
>> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>> >
>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer & PMC / Architect @RedHat
> Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io
>
>


-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Issue with maximumPoolSize & Netty4-http component

Posted by Charles Moulliard <ch...@gmail.com>.
Hi Willem,

Thx for your input. I have fixed my problem by setting the parameter on the
component itself

            public void configure() throws Exception {

                NettyHttpConfiguration nettyConfig = new
NettyHttpConfiguration();
                nettyConfig.setMaximumPoolSize(2);
                NettyHttpComponent nettyHttp = new NettyHttpComponent();
                nettyHttp.setConfiguration(nettyConfig);

                getContext().addComponent("netty4-http", nettyHttp);
                nettyHttp.start();

                // expose a echo service
                from("netty4-http:http://localhost:{{port}}/echo")
                        .log(">> Thread name : ${threadName}")
                        .transform(body().append(body())).to("mock:result");
            }

Only 2 threads are created now

Regards,

Charles

On Thu, Jan 14, 2016 at 2:33 AM, Willem Jiang <wi...@gmail.com>
wrote:

> Hi Charles,
>
> You should be able to setup the maximumPoolSize on the Netty4-http
> component level due to CAMEL-8031[1].
> And the maximumPoolSize only works for consumer side.
>
> [1]https://issues.apache.org/jira/browse/CAMEL-8031
>
> --
> Willem Jiang
>
>
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On January 14, 2016 at 1:09:04 AM, Charles Moulliard (ch007m@gmail.com)
> wrote:
> > Hi,
> >
> > When I debug this unit test
> > https://gist.github.com/cmoulliard/123261f7ac2a9d5c719c, the Camel
> Netty4
> > HTTP Endpoint is well created with the param "maximumPoolSize=2"
> >
> > main TRACE [org.apache.camel.impl.DefaultComponent] - Creating endpoint
> > uri=[netty4-http://http://localhost:26025/echo?maximumPoolSize=2],
> path=[
> > http://localhost:26025/echo], parameters=[{maximumPoolSize=2}]
> >
> > but the number of threads reported by Netty is still bigger than 2
> >
> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
> > Camel (camel-1) thread #1 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #1 - NettyEventExecutorGroup
> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> > Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> > Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> > Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> > Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> > Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
> >
> > Do I have to use another param to set the ThreadPool used by Netty4-http
> ?
> >
> >
> > Regards,
> >
> > --
> > Charles Moulliard
> > Apache Committer & PMC / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> >
>
>


-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Issue with maximumPoolSize & Netty4-http component

Posted by Willem Jiang <wi...@gmail.com>.
Hi Charles,

You should be able to setup the maximumPoolSize on the Netty4-http component level due to CAMEL-8031[1].
And the maximumPoolSize only works for consumer side.

[1]https://issues.apache.org/jira/browse/CAMEL-8031

--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 14, 2016 at 1:09:04 AM, Charles Moulliard (ch007m@gmail.com) wrote:
> Hi,
>  
> When I debug this unit test
> https://gist.github.com/cmoulliard/123261f7ac2a9d5c719c, the Camel Netty4
> HTTP Endpoint is well created with the param "maximumPoolSize=2"
>  
> main TRACE [org.apache.camel.impl.DefaultComponent] - Creating endpoint
> uri=[netty4-http://http://localhost:26025/echo?maximumPoolSize=2], path=[  
> http://localhost:26025/echo], parameters=[{maximumPoolSize=2}]
>  
> but the number of threads reported by Netty is still bigger than 2
>  
> Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
> Camel (camel-1) thread #1 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #1 - NettyEventExecutorGroup
> Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> Camel (camel-1) thread #3 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #3 - NettyEventExecutorGroup
> Camel (camel-1) thread #4 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #4 - NettyEventExecutorGroup
> Camel (camel-1) thread #0 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #0 - NettyEventExecutorGroup
> Camel (camel-1) thread #2 - NettyEventExecutorGroup INFO [route1] - >>
> Thread name : Camel (camel-1) thread #2 - NettyEventExecutorGroup
>  
> Do I have to use another param to set the ThreadPool used by Netty4-http ?
>  
>  
> Regards,
>  
> --
> Charles Moulliard
> Apache Committer & PMC / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>