Distributing Weight
This section describes the rules of allocating read weights to DB instances of various specifications.
Weight Distribution Rules
The default weight equals to the number of vCPUs multiplied by 50. The weight ranges from 100 to 1000.
For example:
- If the number of vCPUs is 1, the weight is 100 (1 x 50 = 50, rounded up to the minimum value within the range).
- If the number of vCPUs is 8, the weight is 400 (8 x 50 = 400).
- If the number of vCPUs is 32, the weight is 1000 (32 x 50 = 1600, rounded down to the maximum value within the range).
| vCPUs | Memory (GB) | Weight |
|---|---|---|
| 1 | 2 | 100 |
| 1 | 4 | 100 |
| 1 | 8 | 100 |
| 2 | 4 | 100 |
| 2 | 8 | 100 |
| 2 | 16 | 100 |
| 4 | 8 | 200 |
| 4 | 16 | 200 |
| 4 | 32 | 200 |
| 8 | 16 | 400 |
| 8 | 32 | 400 |
| 8 | 64 | 400 |
| 16 | 32 | 800 |
| 16 | 64 | 800 |
| 16 | 128 | 800 |
| 32 | 64 | 1000 |
| 32 | 128 | 1000 |
| 32 | 256 | 1000 |
| 60 | 128 | 1000 |
| 60 | 256 | 1000 |
| 60 | 512 | 1000 |
Specifying Whether a SQL Statement Is Sent to the Primary DB Instance or Read Replica By Adding a Hint
Hints supported by RDS read/write splitting are as follows:
/*FORCE_MASTER*/: A SQL statement is executed on the primary DB instance.
/*FORCE_SLAVE*/: A SQL statement is executed on a read replica.
- In addition to the weight distribution system of read/write splitting, hints serve as a complementary SQL syntax to specify whether a SQL statement is executed on the primary DB instance or a read replica.
- Hints are only used as routing suggestions. In non-read-only SQL and non-transaction scenarios, SQL statements cannot be routed to read replicas.
Last Article: Disabling Read/Write Splitting
Next Article: Testing Read/Write Splitting Performance
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.