Introducing Read Weight Assignment Rules
Read weights are assigned to read replicas by their specifications.
Weight Assignment Rules
![](https://support.huaweicloud.com/intl/en-us/usermanual-gaussdbformysql/public_sys-resources/note_3.0-en-us.png)
The default weight of a read replica is (Number of vCPUs) x 50.
If the number of vCPUs is 4, the weight is 200 (4 x 50 = 200).
vCPUs |
Memory (GB) |
Weight |
---|---|---|
4 |
16 |
200 |
8 |
32 |
400 |
16 |
64 |
800 |
32 |
128 |
1,000 |
48 |
192 |
1,000 |
60 |
256 |
1,000 |
Specifying Whether a SQL Statement Is Sent to the Primary Node or Read Replica By Adding a Hint
Hints supported by read/write splitting are as follows:
/*FORCE_MASTER*/: A SQL statement is executed on a primary node.
/*FORCE_SLAVE*/: A SQL statement is executed on read replicas.
![](https://support.huaweicloud.com/intl/en-us/usermanual-gaussdbformysql/public_sys-resources/note_3.0-en-us.png)
- In addition to the weight assignment rules of read/write splitting, hints serve as a complementary SQL syntax to specify whether a SQL statement is executed on a primary node or 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.
- If you want to connect to an instance using the MySQL CLI and Hints, add the -c option.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot