You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Carlo Camerino <ca...@gmail.com> on 2009/07/29 12:06:46 UTC

Load Balancing Questions

Hi,

I have an inquiry regarding balancing.
If i use round robin load balancing, it will distribute my requests into
three different queues which have different processors in them.

If I spawn for example 200 threads, they will go to queue 1,2,3 in a round
robin way.
This is if 200 threads each have 1 requests

What if for example I have 200 threads?
but each thread can have a variable number of requests?

Is there anyway that I can set it

1st Thread - 3 requests ( All GOes To Queue 1)
2nd Thread - 4 requests ( All Goes To Queue 2)
3rd Thread - 1 request ( Goes To Queue 3)
4th Thread - 3 request( Goes TO Queue 1)

So in short, the affinity is related to the thread ( or thread id) i'm not
sure.

Is there a way for  camel to do this?

Thanks A Lot!

Re: Load Balancing Questions

Posted by Carlo Camerino <ca...@gmail.com>.
thanks a lot!

will try it soon and give you feedback

On Wed, Jul 29, 2009 at 6:16 PM, Roman Kalukiewicz <
roman.kalukiewicz@gmail.com> wrote:

> Hello Carlo!
>
> You can try StickyLoadBalancer instead of regular one and have an
> expression that returns the current thread like
> from("direct:start").loadBalance().
>                sticky(new Expression() { public evaluate(Exchange e,
> Thread.class){return Thread.currentThread();}}).to("mock:x", "mock:y",
> "mock:z");
>
> I believe it should work.
>
> Roman
>
> 2009/7/29 Carlo Camerino <ca...@gmail.com>:
> > Hi,
> >
> > I have an inquiry regarding balancing.
> > If i use round robin load balancing, it will distribute my requests into
> > three different queues which have different processors in them.
> >
> > If I spawn for example 200 threads, they will go to queue 1,2,3 in a
> round
> > robin way.
> > This is if 200 threads each have 1 requests
> >
> > What if for example I have 200 threads?
> > but each thread can have a variable number of requests?
> >
> > Is there anyway that I can set it
> >
> > 1st Thread - 3 requests ( All GOes To Queue 1)
> > 2nd Thread - 4 requests ( All Goes To Queue 2)
> > 3rd Thread - 1 request ( Goes To Queue 3)
> > 4th Thread - 3 request( Goes TO Queue 1)
> >
> > So in short, the affinity is related to the thread ( or thread id) i'm
> not
> > sure.
> >
> > Is there a way for  camel to do this?
> >
> > Thanks A Lot!
> >
>

Re: Load Balancing Questions

Posted by Roman Kalukiewicz <ro...@gmail.com>.
Hello Carlo!

You can try StickyLoadBalancer instead of regular one and have an
expression that returns the current thread like
from("direct:start").loadBalance().
                sticky(new Expression() { public evaluate(Exchange e,
Thread.class){return Thread.currentThread();}}).to("mock:x", "mock:y",
"mock:z");

I believe it should work.

Roman

2009/7/29 Carlo Camerino <ca...@gmail.com>:
> Hi,
>
> I have an inquiry regarding balancing.
> If i use round robin load balancing, it will distribute my requests into
> three different queues which have different processors in them.
>
> If I spawn for example 200 threads, they will go to queue 1,2,3 in a round
> robin way.
> This is if 200 threads each have 1 requests
>
> What if for example I have 200 threads?
> but each thread can have a variable number of requests?
>
> Is there anyway that I can set it
>
> 1st Thread - 3 requests ( All GOes To Queue 1)
> 2nd Thread - 4 requests ( All Goes To Queue 2)
> 3rd Thread - 1 request ( Goes To Queue 3)
> 4th Thread - 3 request( Goes TO Queue 1)
>
> So in short, the affinity is related to the thread ( or thread id) i'm not
> sure.
>
> Is there a way for  camel to do this?
>
> Thanks A Lot!
>