views:

618

answers:

2

Hi

I am considering to develop an web application with Spring and OSGi. It seems like they fit together nicely. What are the options for clustering and loadbalancing such an app and what are the pros and cons of each?

Thanks

A: 

I'm providing building blocks links for what you want, the pages will give explanations better than I could provide for you here:

Apache ServiceMix 4:

http://servicemix.apache.org/SMX4NMR/13-clustering.html

Or Fuse ESB:

http://fusesource.com/products/enterprise-servicemix/

Apache CXF:

http://cxf.apache.org/

With Distributed OSGi:

http://cxf.apache.org/distributed-osgi.html

Apache Camel:

http://camel.apache.org/

With Jetty:

http://camel.apache.org/jetty.html

e.tadeu
Thank you. Camel and ESBs seem irrelevant for my case. Distributed OSGi looks very interesting. But not quite what I want. I want to have a cluster of equal interchangeable servers that are loadbalanced and provide failover.
artemb
I would suggest then that messaging, particularly including EIP provided by camel, would actually be quite useful to you.
ptomli
A: 

Neither OSGi nor Spring were created to solve problems such as high-availability, clustering or load-balancing. You could, of course, build a clustered and load-balanced system using Spring and OSGi, but you are probably going to need something else as well, such as a way to detect and communicate node failures and load levels.

Since you are building a web application, most likely you will be using one of the many application servers. Good AS products provide clustering for you. Some also provide load balancing. You can also achieve load balancing through a completely independent setup of your own, using Apache for example to front your main application servers.

If you are really bent on creating your own solution, I have seen JGroups being used in multiple products to provide the necessary infrastructure to build a clustering and/or load-balancing solution. Some of the distributed in-memory caching products use JGroups, for example.

Talking about distributed caches, products such as Ehcache can help with scaling and load-balancing problems.

omerkudat