Home > Blockchain >  RDS PostgreSQL read replica considerations
RDS PostgreSQL read replica considerations

Time:01-09

I have a database that is maxing out on CPU. I would like to spin up a read replica so that my services use the replica to read and that removes some of the pressure of the master db.

  1. If the cpu of the master is approaching 100 - will the read replicas also use as much cpu to keep up?
  2. Will rds (magically) manage the traffic as other engines do to route the read requests to the replicas but use the master for all the transactions, inserts and updates? Or do I have to refactor my code to read from the replica and write to the master?

CodePudding user response:

  1. The Read replica will have to handle a similar level of write traffic as the primary since changes are replicated to it. If your primary driver of CPU load on the primary is write-traffic, chances are that the load will also be relatively high on the replica, or the replication lag will increase.

    If your traffic is very read-heavy (which is much more common), the situation should look different.

  2. RDS won't magically do that, you have to refactor your code to direct read-only traffic to the read replica. Sometimes your Entity-Relationship-Framework supports this through configuration, though.

  • Related