camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Kalukiewicz <roman.kalukiew...@gmail.com>
Subject Re: Load Balancing Questions
Date Wed, 29 Jul 2009 10:16:37 GMT
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 <carlo.camerino@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!
>

Mime
View raw message