TU Wien:Verteilte Systeme VO (Dustdar)/Client centric consistency
The general idea of read set and write sets is that
- read set: we have seen those things already, please preserve them even if we connect somewhere else
- write set: we have done those things already, please preserve them even if we connect somewhere else
Read set and write set example[Bearbeiten | Quelltext bearbeiten]
Client centric consistency wasn't well explained in the VO. So here's an illustrative example.
We have a social media network with two replica servers, L1 and L2.
At the beginning, the servers are mostly empty. No writes have happened yet.
And we have three clients, A and B and C. At the beginning, their read sets and their write sets are empty.
Client A connects to L1, and then adds a "like" to B's profile picture. (It's probably a profile picture of a cute cat.)
The server gets the like and responds with an ID of the like. Notice how the ID makes it possible to identify the server where it happened.
The client then happily puts the ID into their write set.
Monotonic writes
From now on, if the client wants "monotonic writes", then the client can tell a server to at least have a version where the "like B" has happened.
For example, let's say that client A connects to server L2, and wants to make sure that their like is visible. ("monotonic writes" aka the client's writes don't seemingly disappear.)
Client A starts by sending their write set { like B L1 } to L2. Then, L2 notices that it's not up to date, so L2 asks L1. From there, it gets the like and notes it down.
Monotonic reads
If we want "monotonic reads", then that's also easy to implement. Let's go over a case with client B.
Client B, which knows nothing, connects to L1 and reads their profile. They send over their empty write set.
L1 responds with the "like B". Now B can see A's like, and B has to add "like B L1" to their read set.
With that, B has { like B L1 } in their read set, and when B accesses L2, they can send their read set to the server, to indicate that at least that should be visible.
("monotonic reads" aka the client's reads don't seemingly disappear)