CDP:Read Replica Pattern

From AWS-CloudDesignPattern
Revision as of 00:35, 28 November 2012 by Cdpadmin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Architect

Load Distribution through Read Replicas

Contents

Problem to Be Solved

Often server specifications are upgraded (that is, the server is scaled-up) when the resources of a database server are overwhelmed when the frequency of access to the database is high. When scaling-up becomes difficult, you can perform scaling-out ito horizontally distribute the database servers; however, typically this is difficult as well. Normally the proportion of reading from a database is high when compared to writing to the database, so you should distribute the reading processes to the performance of the system as a whole.

Explanation of the Cloud Solution/Pattern

There are several ways to improve the reading performance. You can use this pattern to improve the overall performance through distributing the reading into multiple "Read Replicas" (that is, replicas for reading). A Read Replica follows the writing to a master, reflecting the data to itself. You can reduce the load on the master through using primarily Read Replicas for reading.

Implementation

The AWS Relational Database Management Systems (RDBMS) service, the Amazon Relational Database Service (RDS), has a function enabling the easy creation of a read-only database known as a "Read Replica." An EC2 instance can also be used instead to create a read-only database.

  • Create a read-only replica of the master database. For a database handled by RDS, create the read-only replica using the Read Replica function.
  • When data is read by an application, set the access destination to the Read Replica.
  • While multiple Read Replicas can be used, they must be assigned on the application side. In doing so, middleware such as HAProxy or MySQL Proxy may be used as well.

Configuration

2XNdewVsgellO3x8-1506D.png

Benefits

  • If the load in reading from a database is high, you can use this to distribute that load.
  • This is also effective if you want to perform a process without placing a load on the master database, in, for example, a data analysis application.
  • Because the purpose of the Read Replica is not that of a redundant configuration, if the point is to increase database durability, consider database replication itself, rather than a Read Replica. Of course, you can use a Read Replica and database replication in parallel.
  • Typically, a Read Replica is an asynchronous replication, so be aware that there will be a slight lag between the master and the Read Replica.
  • Disabling the automatic backup n an RDS (that is, setting the "Backup Retention Period" to 0), will prevent the Read Replica from that RDS.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox