avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <l...@silveregg.co.jp>
Subject Poor Man's Clustered DataSource Package.
Date Mon, 04 Feb 2002 03:39:08 GMT
 We have been working on scalability issues for an application that we
have implented on Apache. One of the big bottlenecks has been our
backend database. We needed to have a way to distribute our data without
having to pay for a truely clustered database solution.

We decided to implement a kind of poor man's cluster by dividing our
data amongst a cluster of backend databases and then accessing the data
using the modulous of the hash of the data's primary key. This lets us
reliably access the data even though it is distributed across several

I added a new package called cluster under the datasource package in the
scratchpad containing the classes that we are using. It contains 3
implementations HashedDataSourceCluster.java,
IndexedDataSourceCluster.java, and RoundRobinDataSourceCluster.java. The
Javadocs for each class explain how to get up and running with them.
Basicly, they each allow you to define a set of regular DataSources
which will then be treated as a DataSource Cluster. You modify the
configuration of your user component so that the dbpool tag points to a
Cluster, which implements Cluster, rather than a DataSource. The
RoundRobinDataSourceCluster will work without any modifications to your
code, but it has limited applications. The HashedDataSourceCluster
requires that you modify calls to getConnection so that they pass in a
hashCode or an index, in the case of IndexedDataSourceCluster. (They are
each described in more depth in the javadocs)

I was wondering if anyone on the list has had any experience setting up
Data Base Clusters like this who might have some advice on how they
could be better implemented. These have been working for us so far, but
are still new.


To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message