Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cluster and load balance a Spring + OSGi app

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?

like image 273
artemb Avatar asked Oct 15 '22 10:10

artemb


1 Answers

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.

like image 118
omerkudat Avatar answered Nov 01 '22 08:11

omerkudat