|
1 | 1 | # Manage group replication flow control |
2 | 2 |
|
3 | | -In replication, flow control prevents one member from falling too far behind the cluster and avoids excessive buffering. A cluster is not required to keep members in sync together for replication. The pending transactions in the relay log only increase for the lagging replica. Each member sends statistics to the group. |
| 3 | +Flow control prevents one member from falling too far behind the cluster. This mechanism avoids excessive buffering in the relay log. Each member sends statistics to the group to coordinate throughput. |
4 | 4 |
|
5 | | -Flow control sets a threshold on the queue for transactions waiting in the certification queue or the transactions waiting in the applier queue. If the thresholds are exceeded, and during the duration that they are exceeded, flow control adjusts the writer members to the capacity of the delayed member. This action ensures that all members are in sync. |
| 5 | +Flow control monitors two queues: |
6 | 6 |
|
7 | | -Flow controls work asynchronously and depend on the following: |
| 7 | +* Transactions waiting in the certification queue |
| 8 | + |
| 9 | +* Transactions waiting in the applier queue |
| 10 | + |
| 11 | +When transactions exceed the configured thresholds, flow control throttles writer members. This throttling matches writer throughput to the capacity of the slowest member. |
| 12 | + |
| 13 | +Flow control operates asynchronously and depends on the following: |
8 | 14 |
|
9 | 15 | * Monitoring the throughput and queue sizes of each member |
10 | | -* Throttling members to avoid writing beyond the capacity available |
11 | 16 |
|
12 | | -The following system variables set flow control behavior for Group Replication: |
| 17 | +* Throttling members to prevent writes beyond available capacity |
| 18 | + |
| 19 | +## System variables |
| 20 | + |
| 21 | +The following system variables configure flow control behavior for Group Replication: |
| 22 | + |
| 23 | +* [`group_replication_flow_control_mode` :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options.html#sysvar_group_replication_flow_control_mode) |
| 24 | + |
| 25 | +* [`group_replication_flow_control_certifier_threshold` :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options) |
| 26 | + |
| 27 | +* [`group_replication_flow_control_applier_threshold` :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options.html#sysvar_group_replication_flow_control_applier_threshold) |
| 28 | + |
| 29 | +Set `group_replication_flow_control_mode` to enable or disable flow control. Configure thresholds at the certifier level, applier level, or both. |
| 30 | + |
| 31 | +### Configure flow control mode |
| 32 | + |
| 33 | +The `group_replication_flow_control_mode` variable accepts the following values: |
| 34 | + |
| 35 | +* `DISABLED` - Flow control is off |
| 36 | + |
| 37 | +* `QUOTA` - Flow control uses a quota-based throttling mechanism (default) |
| 38 | + |
| 39 | +```sql |
| 40 | +-- Disable flow control |
| 41 | +SET GLOBAL group_replication_flow_control_mode = 'DISABLED'; |
| 42 | + |
| 43 | +-- Enable quota-based flow control |
| 44 | +SET GLOBAL group_replication_flow_control_mode = 'QUOTA'; |
| 45 | +``` |
| 46 | + |
| 47 | +### Configure threshold values |
| 48 | + |
| 49 | +The certifier threshold sets the maximum transactions allowed in the certification queue. The default value is 25000. |
| 50 | + |
| 51 | +```sql |
| 52 | +-- Set certifier threshold to 10000 transactions |
| 53 | +SET GLOBAL group_replication_flow_control_certifier_threshold = 10000; |
| 54 | +``` |
| 55 | + |
| 56 | +The applier threshold sets the maximum transactions allowed in the applier queue. The default value is 25000. |
| 57 | + |
| 58 | +```sql |
| 59 | +-- Set applier threshold to 10000 transactions |
| 60 | +SET GLOBAL group_replication_flow_control_applier_threshold = 10000; |
| 61 | +``` |
| 62 | + |
| 63 | +Flow control triggers when either threshold is exceeded on any member. |
| 64 | + |
| 65 | +## Status variables |
| 66 | + |
| 67 | +Status variables are read-only and cannot be changed at runtime. These variables report the state of flow control on each member. |
| 68 | + |
| 69 | +* `group_replication_flow_control_active` - Reports whether flow control is throttling transactions. Returns `ACTIVE` when engaged or `DISABLED` when not throttling. |
| 70 | + |
| 71 | +* `group_replication_flow_control_threshold_nodes` - Lists members that trigger flow control. The format is `(count/total)` followed by a comma-separated list of member IDs. |
| 72 | + |
| 73 | +* `group_replication_flow_control_throttle_quota` - Reports the maximum transactions allowed per flow control period. |
| 74 | + |
| 75 | +### Query flow control status |
| 76 | + |
| 77 | +The following query displays flow control status variables when throttling is active: |
| 78 | + |
| 79 | +```sql |
| 80 | +mysql> SHOW GLOBAL STATUS LIKE '%flow_control%'; |
| 81 | ++-----------------------------------------------+------------------------------------------+ |
| 82 | +| Variable_name | Value | |
| 83 | ++-----------------------------------------------+------------------------------------------+ |
| 84 | +| group_replication_flow_control_active | ACTIVE | |
| 85 | +| group_replication_flow_control_threshold_nodes| (2/3)node1:33061,node2:33061 | |
| 86 | +| group_replication_flow_control_throttle_quota | 5000 | |
| 87 | ++-----------------------------------------------+------------------------------------------+ |
| 88 | +``` |
| 89 | + |
| 90 | +The following output shows the status variables when flow control is not engaged: |
| 91 | + |
| 92 | +```sql |
| 93 | +mysql> SHOW GLOBAL STATUS LIKE '%flow_control%'; |
| 94 | ++-----------------------------------------------+------------------------------------------+ |
| 95 | +| Variable_name | Value | |
| 96 | ++-----------------------------------------------+------------------------------------------+ |
| 97 | +| group_replication_flow_control_active | DISABLED | |
| 98 | +| group_replication_flow_control_threshold_nodes| (0/3) | |
| 99 | +| group_replication_flow_control_throttle_quota | 0 | |
| 100 | ++-----------------------------------------------+------------------------------------------+ |
| 101 | +``` |
| 102 | + |
| 103 | +## Related topics |
| 104 | + |
| 105 | +* [Group Replication system variables](group-replication-system-variables.md) |
13 | 106 |
|
14 | | -* [group_replication_flow_control_mode :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options.html#sysvar_group_replication_flow_control_mode) |
15 | | -* [group_replication_flow_control_certifier_threshold :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options) |
16 | | -* [group_replication_flow_control_applier_threshold :octicons-link-external-16:](https://dev.mysql.com/doc/refman/{{vers}}/en/group-replication-options.html#sysvar_group_replication_flow_control_applier_threshold) |
| 107 | +* [Binary logs and replication improvements](binlogging-replication-improvements.md) |
17 | 108 |
|
18 | | -Flow control is enabled and disabled by selecting a value in the group_replication_flow_control_mode variable. Flow control can also be enabled on the certifier or applier level or both and sets the threshold level. |
| 109 | +* [Percona Server for MySQL feature comparison](feature-comparison.md) |
0 commit comments