How do I get to the nearest RMI server?
Continuing my question How to improve the performance of a client server architecture application
I decided to keep a centralized database and multiple slave configurations. I am planning to use Symmetric DS for replication between the slave and the master database. Each server database configuration will be installed closer to the client. Ideally, I want the request from the client to be routed to the closest slave backend database for an obvious reason. Since I am using RMI to connect to the server, I want to know if there is currently any product / API that would allow this?
Any other solution than the one above is much appreciated :)
Note. Refactoring the client code is definitely one of the alternatives, but since the application is very large, its huge risk (could break existing code), time and expensive.
source to share
Take a look at distributed and sequential hashing:
http://en.wikipedia.org/wiki/Distributed_hash_table#Keyspace_partitioning http://en.wikipedia.org/wiki/Consistent_hashing
Barebones, you should set up a sequential hashing option that will take the client id (instead of the "key") and find the closest server. The bonus benefit is that if one of the slaves goes down, your infrastructure will transparently route to the closest nearest server.
source to share