|
|
|
|
|
by a-robinson
3121 days ago
|
|
It helps with both, but is more dramatic for reads. Reads go from 1 RTT to 0 RTTs, while writes go from 2 RTTs to 1 RTT. For example, consider a cluster in which the nodes are 200ms RTT away from each other. * A read will take 200ms if the leaseholder isn't in the local datacenter vs single-digit milliseconds if it is local. * A write will take 400ms if the leaseholder isn't in the local datacenter vs 200 milliseconds if it is local. The write takes 400ms because it takes 100ms to get from the local datacenter to leaseholder, 200ms to reach consensus (the leaseholder needs to send a request to and get a response from one of the followers), and another 100ms for the response from the leaseholder to get back to the local datacenter where the request originated. |
|
Is there a bit more detailed technical doc on how this is actually achieved ideally with some examples? When is it decided that the lease holder moves from one node to another? Is it based on some sort of stats?
Edit: found the doc follow-the-workload here: https://www.cockroachlabs.com/docs/stable/demo-follow-the-wo...