The "client" and "database" are connected by n (where n >= 2)
"servers". See this chart:
client<---->Server 1<------>Database
^ ^
| |
|---------->server 2<---------------------|
| |
| |
|---------->server 3<---------------------|
... ...
The assumptions:
--The client's add/get messages are randomly dispatched to server 1,
2, or 3. These servers run in parallel.
--Each server forwards its received add/get message to the Database,
and forwards the database response (success/failure) back to client.
--Add and get operations on the Database side are atomic to each
other.
--The serves can communicate to each other.
The question:
--can I design a solution to have each server maintain its own cache,
so that Whenever there is a "add" request from the client, the server
stores the data in its cache as well as into the database. And
whenever there is a "get" request from the client, the server will
first look into its cache, and if there is a hit, it will directly
return the data found in its cache to the client, but not forward the
"get" request to the database.
The issue is how to design a synchromization mechanism between those
servers, so that the servers' caches are kept in synch.
I think that this might be a traditional parallel programming issue,
but I am not aware of the solution. Any one please know of a solution?
BTW, I'd like not to have one centralized "cache server" to cache the
data.
Thank you
Mike