[go: up one dir, main page]

Skip to content

Improve `PostReceive` performance by using replica

Problem

As suggested here, we currently use data_consistency: always for PostReceive worker. It means that we send all queries to the primary DB.

PostReceive is used a lot. We call it for each git push event. That puts a pressure on the database.

See Kibana

Proposal

Redirect some of queries generated by PostReceive to replicas if possible.

Would it be possible to explicitly wrap the SELECT queries in a Session#use_replicas_for_read_queries instead of using the wait mechanism?