[Spike] Investigate if it's possible to reduce the number of requests made to the primary db from the PostReceive worker
We have changed the post receive worker's data consistency to sticky which will read from replicas when they are up to date, only switching to the primary for writes and reads where the replicas are not up to date.
In [Feature flag] Enable load_balanacing_for_stick... (#495040 - closed) we enabled the sticky data consistency on production but noted that the number of requests going to the primary didn't drop inline with the number of requests going to the replica.
@reprazent theorized that the worker may be writing at the beginning of execution and causing reads to happen from the primary. If this is the case, we may be able to optimize the workers execution to direct more queries to the replicas.
More context can be found in Improve `PostReceive` performance by using replica (#402254 - closed)
Expected outcome
- Identifying the the queries happening in the
PostReceiveworker. - If possible route more of the reads to the replicas or create an issue to do this in an upcoming release