Depending on the chosen routing and authentication method, the 'Quality of Service' (QoS) setting can be specified as part of the SQL statement, host, or user configuration, and affects the selection of the MySQL server:
This setting enables the connector to redirect the query as if it were read-only, and therefore prefer a Replica over a Primary, but will choose a Primary if no Replica is available.
This setting indicates that the query is a write and should be directed to a Primary.
Where possible, the QoS should be set for read/write splitting according to the current session state.
These hints for the connection can be set, for example by using the
value in the comments during SQL routing, or by setting the
corresponding QoS value in the user.map
file.
Further, connectivity can be influenced by setting a suitable latency
value, or an explicit affinity. This information can be specified either
within the connection strings, within the user.map
,
or through configuration.
The rules for selection of whether a connection is made to a Primary or a Replica is therefore controlled by comparing all of these settings and the selected routing mechanism together.
SmartScale | QoS | Maximum Applied Latency | Selection Order | Affinity | Primary Selected | Replica Selected |
---|---|---|---|---|---|---|
Enabled | Not Specified | Not Specified | Not Specified | Replica:Primary | Yes | Yes |
Not Enabled |
RO_RELAXED
| Not Specified | Not Specified | Replica:Primary | Only if no Replica available | Yes |
Not Enabled |
RO_RELAXED
| Specified | Not Specified | Replica:Primary | Only if no Replica available |
Only if Replica latency <
--connector-max-applied-latency
|