Search code examples
javaopen-sourceload-balancing

Is there a good open source abstract load balancing library for Java?


I'm looking for an open source library that will allow programmatic loadbalancing across a set of calls to nodes of arbitrary form - so no assumptions about HTTP or anything else, just a method call on an object. Ideally it would provide the following functionality:

  • Balances the load equally
  • Retry on a different node if a call to a node throws an exception
  • Move a node to a "broken" state if a call to it fails, and make no further calls to it
  • Have a mechanism for doing background pings to all nodes (broken and active) that will restore broken ones to active state when they return and proactively move active ones to broken state if they fail

I feel this ought to exist already, but some googling has yet to find it.


Solution

  • Consider using Apache Camel library. There is a flexible load balancer and the library have a vast variety of components so you don't stick to particular protocol or service implementation. With Camel Bean component you can load-balance even POJO method calls.