netty thread pool clarification

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

netty thread pool clarification

kiranreddykasa
Hi ,

Can anyone suggest how to improve performance of netty without using additional thread pool.

As mentioned here that we should not use additional threads http://camel.465427.n5.nabble.com/camel-Activemq-performance-suggestions-td5734508.html

Consider this simple route
from("netty:tcp://localhost:7004?textline=true")
.bean(SleepProcessor.class);

In sleep processor there is single line Thread.sleep(100) , there is no other logic.

If we do load test with this route we are able to get 160 tps .

And if we add .threads(800,800) then we get  ~700 tps.
If we should not use threads option what will be the other alternative?

We tried to load balance by starting the same route with different ports but still no effect.

Thanks
Regards

kiran Reddy
Reply | Threaded
Open this post in threaded view
|

Re: netty thread pool clarification

Claus Ibsen-2
Hi

Well using sleep in performance testing is really not a good idea.
Unless you expect to have heavy CPU business logic running.
If your use-case is more about integrating systems, then the
bottlenecks is often at remote endpoints, waiting for reply messages
et all.

I suggest to construct testing scenarios that resemble your use-cases,
and not use thread sleep.
A thread sleep is a blocking thread which is bad design.








On Tue, Jun 25, 2013 at 1:27 PM, kiranreddykasa <[hidden email]> wrote:

> Hi ,
>
> Can anyone suggest how to improve performance of netty without using
> additional thread pool.
>
> As mentioned here that we should not use additional threads
> http://camel.465427.n5.nabble.com/camel-Activemq-performance-suggestions-td5734508.html
>
> Consider this simple route
> from("netty:tcp://localhost:7004?textline=true")
> .bean(SleepProcessor.class);
>
> In sleep processor there is single line Thread.sleep(100) , there is no
> other logic.
>
> If we do load test with this route we are able to get 160 tps .
>
> And if we add .threads(800,800) then we get  ~700 tps.
> If we should not use threads option what will be the other alternative?
>
> We tried to load balance by starting the same route with different ports but
> still no effect.
>
> Thanks
>
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/netty-thread-pool-clarification-tp5734734.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: netty thread pool clarification

kiranreddykasa
Hi,

Thanks for quick reply.

And generally on a netty consumer is it okay to use additional thread pool or default thread pool is enough ?
If default pool is enough what is it's pool size and how can I increase it?
Regards

kiran Reddy
Reply | Threaded
Open this post in threaded view
|

Re: netty thread pool clarification

Hack Kampbjørn
You had 160 tps with a 100ms sleep that gives a pool of 16 threads. In Netty 4.0 the default pool size will be twice the number of cores, I guess it's the same for current 3.x that camel is using. You are running on a system with 8 CPU cores (and 0% overhead inside netty or camel).

A computer cannot run more task that number of cores. If your code is not blocking (camel-netty doesn't block but your thread.sleep example does) then any thread pool bigger than number of cores is big enough.

Why are you using Thread.sleep? Are you trying to simulate a CPU heavy task, then you should add more CPU cores. If you are simulating an external system that will take 100ms to respond then convert your SleepProcessor to use AsyncProcessor and schedule the callback object to be notified after 100ms

http://camel.apache.org/asynchronous-processing.html


On 2013-06-25, at 13:56, kiranreddykasa <[hidden email]> wrote:

> Hi,
>
> Thanks for quick reply.
>
> And generally on a netty consumer is it okay to use additional thread pool
> or default thread pool is enough ?
> If default pool is enough what is it's pool size and how can I increase it?
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/netty-thread-pool-clarification-tp5734734p5734738.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: netty thread pool clarification

kiranreddykasa
Hi ,

I was trying to simulate normal bussiness logic like checking ,inserting or updating

to database.

Assuming these steps take 100 ms, So instead of writing the logic I have kept sleep(100).

Anyway thanks for your explanation.
Regards

kiran Reddy