lbpool – Load Balancing JDBC Pool

The lbpool project provides a load balancing JDBC driver for use with DB connection pools. It wraps a normal JDBC driver providing reconnect semantics in the event of additional hardware availability, partial system failure, or uneven load distribution. It also evenly distributes all new connections among slave DB servers in a given pool. Each time connect() is called it will attempt to use the best server with the least system load.

The biggest scalability issue with large applications that are mostly READ bound is the number of transactions per second that the disks in your cluster can handle. You can generally solve this in two ways.

1. Buy bigger and faster disks with expensive RAID controllers.
2. Buy CHEAP hardware on CHEAP disks but lots of machines.

We prefer the cheap hardware approach and lbpool allows you to do this.

Even if you *did* manage to use cheap hardware most load balancing hardware is expensive, requires a redundant balancer (if it were to fail), and seldom has native support for MySQL.

The lbpool driver addresses all these needs.

The original solution was designed for use within MySQL replication clusters. This generally involves a master server handling all writes with a series of slaves which handle all reads. In this situation we could have hundreds of slaves and lbpool would load balance queries among the boxes. If you need more read performance just buy more boxes.

If any of them fail it won’t hurt your application because lbpool will simply block for a few seconds and move your queries over to a new production server.

While currently designed for MySQL this could easily be updated to support PostgresQL or any other DB that supports replication.

btw, the download link from http://code.tailrank.com/lbpool/ is not correct, the correct one is http://download.tailrank.com/lbpool-1.1.0.tar.gz

Leave a Reply