Score:0

Google cloud sql read replica consistency

il flag

Does Google Cloud SQL read replicas guarantees consistency? And how long does it take to replicate from primary to read replicas typically? I can't find information on the above two questions.

Score:0
cn flag

Google Cloud SQL provides read replica eventual consistency. The time that it takes a replica to catch up to the master is called Replication lag.

How long is replication lag? That depends entirely on how busy the master and replicas are. You can determine this value by reading the Seconds_behind_Master metric (MySQL). See this link for PostgreSQL.

A good practice when updating the master is to set a flag and temporarily direct all reads to the master. This is typically handled by connection pooling logic that understands read-write masters and read-only slaves.

For more information see this document:

Managing replicas

il flag
"A good practice when updating the master is to set a flag and temporarily direct all reads to the master. This is typically handled by connection pooling logic that understands read-write masters and read-only slaves." - can you explain more on this? i.e., how does other application knows that the master is being written so that they are reading from master rather than slaves?
John Hanley avatar
cn flag
The software that manages connection pools typically has this feature. In order to properly support read-only replicas, you need software that knows which is which and only writes to the master. The same software can make decisions on replication lag and only read from the master for a short period of time. I have written articles about this on my website.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.