The default is to use a strong read which does some coordination with the leader. For optimized revision computation, it should be fine to use the timestamp returned by the local spanner node and skip the extra coordination.
Testing with a single-region spanner saw these queries drop an order of magnitude.
It is probably also fine to use a stale read for the HeadRevision call, but holding off for further testing in case it could potentially cause a new enemy problem.
To test this (since testing this behavior requires a real spanner), I built a modified image with the following now function, and ran it in a stage environment against a (small) spanner:
The default is to use a strong read which does some coordination with the leader. For optimized revision computation, it should be fine to use the timestamp returned by the local spanner node and skip the extra coordination.
Testing with a single-region spanner saw these queries drop an order of magnitude.
It is probably also fine to use a stale read for the HeadRevision call, but holding off for further testing in case it could potentially cause a new enemy problem.
To test this (since testing this behavior requires a real spanner), I built a modified image with the following now function, and ran it in a stage environment against a (small) spanner:
To compare the performance of stale vs. strong reads here.
Some logs from the test: