The logical partition index (yz_cover:logical_index) is calculated
from scratch for every single write. This is silly. It wastes CPU and
adds unnecessary latency. The only time this index changes is if the
ring is changed which can only happen during ring resizing. This index
should be cached. This could be done as part of the cover plan
generation which is done async every two seconds. That is probably too
aggressive given the ring should rarely, if ever, change, but it means
that there is a maximum of a ~2 second delay between the ring changing
the the logical index reflecting that change. If worried about this 2s
delay each write op could compare the latest ring number to the cached
ring number and if they don't match then re-generate the plan.
The logical partition index (
yz_cover:logical_index) is calculatedfrom scratch for every single write. This is silly. It wastes CPU and
adds unnecessary latency. The only time this index changes is if the
ring is changed which can only happen during ring resizing. This index
should be cached. This could be done as part of the cover plan
generation which is done async every two seconds. That is probably too
aggressive given the ring should rarely, if ever, change, but it means
that there is a maximum of a ~2 second delay between the ring changing
the the logical index reflecting that change. If worried about this 2s
delay each write op could compare the latest ring number to the cached
ring number and if they don't match then re-generate the plan.