views:

96

answers:

1

In continuation to my question How to improve the performance of client server architecture application

I have decided to maintain a centralized database and several slave server-database configuration. I plan to use Symmetric DS for replicating between the slave and master database. Each server-database configuration would be installed closer to the client. Ideally I want the request from a client to route to the nearest slave server-database for the obvious reason. Since I'm using RMI to connect to the server, I want to know if there is any product/API currently available, which would solve this?

Any other solution than the above one is highly regarded :)

Note: Refactoring the client code is definitely one alternative but since the application is very huge, its a huge risk (can break existing code), time taking & expensive.

+1  A: 

Take a look at distributed and consistent hashing:

http://en.wikipedia.org/wiki/Distributed_hash_table#Keyspace_partitioning http://en.wikipedia.org/wiki/Consistent_hashing

Barebones, you would setup a variant of consistent hashing that would take the identifier of the client (in lieu of the 'key') and locate the nearest server. Bonus benefit here is that if one of the slaves goes down, your infrastructure will transparently route to the next nearest server.

Is there any solution available which implements Distributed Hash table? I can't seem to find it on google.
Snehal
As mentioned, you would need to do a 'variant' of consistent hashing but perhaps this will help you get started:http://weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.htmlAlso, any Java P2P x-Sharing system (x: {file, etc.}) probably has implemented a distributed hash algorithm. (I would start with freenet, or the bittorrent client in java ..)