You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Spandit2 <Sp...@csc.com> on 2012/08/30 22:05:04 UTC

DOSGI Service load balancing

Hello All ,

I am using CXF DOSGI to implement so REST services and deployed them in
Jboss AS7 . I am wondering how can I provide load balancing and fail over
around these services.  I have service registry where all these services are
registered , Have multiple instances of same service running on different
node . 

But I am missing how to load balance these services ? 

I read some articles talking about implementing proxy service which looks
into service registry and decide which service to invoke . But how does this
proxy service selects which service to invoke . Are there any good examples
of proxy service ?

Any insights would be helpful.

Thanks
Sunil



--
View this message in context: http://cxf.547215.n5.nabble.com/DOSGI-Service-load-balancing-tp5713383.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: DOSGI Service load balancing

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 31/08/12 15:30, Spandit2 wrote:
> Sergey
>
> Thanks for your quick response and sharing these two approaches . To me it
> looks like this approach will work if the web service consumer is running
> inside same container . Unfortunately client for my services is application
> running on force.com . So the load balancing and fail over has to be
> something outside and supported by container .
>
> I am thinking of implementing a Proxy service as a plain cxf web service
> (Not OSGI Service) . This Proxy service can then go to service registry ,
> get the list of available services and then execute the local service or
> service from other node to support fail over.
>
> The proxy service will be exposed on HTTP port (and not on osgi-http port on
> jboss) and therefore can be load balanced by the Jboss AS 7 Web container.
>
> I also read blog by David Bosschaert
>
> http://coderthoughts.blogspot.com/2009/02/distributed-osgi-simple-example.html.
>
> In one of the response he said
>
> "A service has arbitrary map of properties associated with it ."  These
> properties can be passed to the ServiceTracker as a filter for selecting a
> service when same service is registered/listed in service registry multiple
> times. " A service could publish* (and periodically update) *a property
> which advertises its load and the load balancer could automatically select
> the service with the lowest load"
>
> Question is I know how to set the properties on service during registration
> . But how do I update these properties ?

I guess this is better to be managed by having Activator implementing 
ManagedService, where it can then update the properties of individual 
services it publishes. May be DSW itself can itself publish every 
service it creates as ManagedService, but the question there is how to 
allocate unique, descriptive ids to such services, in cases when say the 
same interface is published on different ports, etc

Sergey

>
> Thanks
> Sunil
>
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/DOSGI-Service-load-balancing-tp5713383p5713402.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: DOSGI Service load balancing

Posted by Spandit2 <Sp...@csc.com>.
Sergey

Thanks for your quick response and sharing these two approaches . To me it
looks like this approach will work if the web service consumer is running
inside same container . Unfortunately client for my services is application
running on force.com . So the load balancing and fail over has to be
something outside and supported by container . 

I am thinking of implementing a Proxy service as a plain cxf web service
(Not OSGI Service) . This Proxy service can then go to service registry ,
get the list of available services and then execute the local service or
service from other node to support fail over. 

The proxy service will be exposed on HTTP port (and not on osgi-http port on
jboss) and therefore can be load balanced by the Jboss AS 7 Web container. 

I also read blog by David Bosschaert 

http://coderthoughts.blogspot.com/2009/02/distributed-osgi-simple-example.html. 

In one of the response he said 

"A service has arbitrary map of properties associated with it ."  These
properties can be passed to the ServiceTracker as a filter for selecting a
service when same service is registered/listed in service registry multiple
times. " A service could publish* (and periodically update) *a property
which advertises its load and the load balancer could automatically select
the service with the lowest load"

Question is I know how to set the properties on service during registration
. But how do I update these properties ?

Thanks
Sunil







--
View this message in context: http://cxf.547215.n5.nabble.com/DOSGI-Service-load-balancing-tp5713383p5713402.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: DOSGI Service load balancing

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 30/08/12 22:05, Spandit2 wrote:
> Hello All ,
>
> I am using CXF DOSGI to implement so REST services and deployed them in
> Jboss AS7 . I am wondering how can I provide load balancing and fail over
> around these services.  I have service registry where all these services are
> registered , Have multiple instances of same service running on different
> node .
>
> But I am missing how to load balance these services ?
>
> I read some articles talking about implementing proxy service which looks
> into service registry and decide which service to invoke . But how does this
> proxy service selects which service to invoke . Are there any good examples
> of proxy service ?
>
The documentation is here:
http://cxf.apache.org/docs/jax-rs-failover.html

Actually, this is out of date (to be updated), as the main CXF feature 
can now be used (same one as for JAX-WS) after Christian did some 
refactoring.

I know of the only example which enables the load balancing at the RS 
client side via the Service Locator, it is available in Talend examples:

https://github.com/Talend/tesb-rt-se/tree/master/examples/tesb/locator-rest

Give that example a try - I think you can do something similar to get 
the services found from the service registry that you use.

I also think you can get the features injected into DOSGi client proxies 
too, as the code checks the properties and features

Let us know how it goes please
Sergey




> Any insights would be helpful.
>
> Thanks
> Sunil
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/DOSGI-Service-load-balancing-tp5713383.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com