The Alibaba Cloud intranet ensures the synchronization of real-time log transfer between the master and read-only instances, and latencies do not occur in read-only instances under normal conditions. However, due to MySQL replication, latencies in data synchronization can occur if log synchronization takes a long time, which is technically unavoidable by MySQL at the moment. To reduce latencies, we recommend that you use read-only instances with the same or higher specifications than the master instance to ensure high performance for log synchronization.
The RDS read/write splitting link supports user-defined latency thresholds. In the read/write splitting system, when the latency of a read-only instance exceeds the threshold, requests are no longer forwarded to the instance but to other instances whose latency fall within the threshold. When the latencies of all read-only instances exceed the threshold, if the read request processing weight of the master instance is not 0, all select requests are forwarded to the master instance; otherwise, a result indicating that these read requests failed to be processed is returned.
When using the read/write splitting function, if you want to obtain real-time data with certain query statements, you can forcibly forward these statements to the master instance for execution using the Hint format. The Hint format of RDS read/write splitting is
/*FORCE_MASTER*/, which specifies that the SQL runs on the master instance. For example, after Hint is prefixed to the following statement, the statement is always routed to and executed on the master instance regardless of the set weight.
/*FORCE_MASTER*/ SELECT * FROM table_name;