You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tiproxy/tiproxy-performance-test.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ The results are as follows:
14
14
- The row number of the query result set has a significant impact on the QPS of TiProxy, and the impact is the same as that of HAProxy.
15
15
- The performance of TiProxy increases almost linearly with the number of vCPUs. Therefore, increasing the number of vCPUs can effectively improve the QPS upper limit.
16
16
- The number of long connections and the frequency of creating short connections have minimal impact on the QPS of TiProxy.
17
+
- The higher the CPU usage of TiProxy, the greater the impact of enabling [traffic capture](/tiproxy/tiproxy-traffic-replay.md) on QPS. When the CPU usage of TiProxy is about 70%, enabling traffic capture leads to approximately 3% decrease in average QPS and 7% decrease in minimum QPS. The latter decrease is caused by periodic QPS drops during traffic file compression.
17
18
18
19
## Test environment
19
20
@@ -312,3 +313,35 @@ sysbench oltp_point_select \
312
313
| 100 | 95597 | 0.52 | 0.65 | 330% | 1800% |
313
314
| 200 | 94692 | 0.53 | 0.67 | 330% | 1800% |
314
315
| 300 | 94102 | 0.53 | 0.68 | 330% | 1900% |
316
+
317
+
## Traffic capture test
318
+
319
+
### Test plan
320
+
321
+
This test aims to evaluate the performance impact of [traffic capture](/tiproxy/tiproxy-traffic-replay.md) on TiProxy. It uses TiProxy v1.3.0 and compares QPS and TiProxy CPU usage with traffic capture enabled and disabled before executing `sysbench` with different concurrency. Due to periodic QPS fluctuations caused by traffic file compression, the test compares both the average and minimum QPS.
Copy file name to clipboardExpand all lines: tiproxy/tiproxy-traffic-replay.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@ Traffic replay is not suitable for the following scenarios:
43
43
> - TiProxy captures traffic on all connections, including existing and newly created ones.
44
44
> - In TiProxy primary-secondary mode, connect to the primary TiProxy instance.
45
45
> - If TiProxy is configured with a virtual IP, it is recommended to connect to the virtual IP address.
46
+
> - The higher the CPU usage of TiProxy, the greater the impact of traffic capture on QPS. To reduce the impact on the production cluster, it is recommended to reserve at least 30% of CPU capacity, which results in an approximately 3% decrease in average QPS. For detailed performance data, see [Traffic capture test](/tiproxy/tiproxy-performance-test.md#traffic-capture-test).
47
+
> - TiProxy does not automatically delete previous capture files when capturing traffic again. You need to manually delete them.
46
48
47
49
For example, the following command connects to the TiProxy instance at `10.0.1.10:3080`, captures traffic for one hour, and saves it to the `/tmp/traffic` directory on the TiProxy instance:
48
50
@@ -76,7 +78,7 @@ Traffic replay is not suitable for the following scenarios:
76
78
77
79
5. View the replay report.
78
80
79
-
After replay completion, the report is stored in the `tiproxy_traffic_report` database on the test cluster. This database contains two tables: `fail` and `other_errors`.
81
+
After replay completion, the report is stored in the `tiproxy_traffic_replay` database on the test cluster. This database contains two tables: `fail` and `other_errors`.
80
82
81
83
The `fail` table stores failed SQL statements, with the following fields:
82
84
@@ -89,16 +91,50 @@ Traffic replay is not suitable for the following scenarios:
89
91
- `sample_replay_time`: the time when the SQL statement failed during replay. You can use this to view error information in the TiDB log file.
90
92
- `count`: the number of times the SQL statement failed.
91
93
94
+
The following is an example output of the `fail` table:
95
+
96
+
```sql
97
+
SELECT * FROM tiproxy_traffic_replay.fail LIMIT 1\G
sample_err_msg: this is an error from the backend connection: failed to read the connection: EOF
129
+
sample_replay_time: 2024-10-17 12:57:39
130
+
count: 1
131
+
```
132
+
99
133
>**Note:**
100
134
>
101
-
> The table schema of `tiproxy_traffic_report` might change in future versions. It is not recommended to directly read data from `tiproxy_traffic_report`in your application or tool development.
135
+
> - The table schema of `tiproxy_traffic_replay` might change in future versions. It is not recommended to directly read data from `tiproxy_traffic_replay`in your application or tool development.
136
+
> - Replay does not guarantee that the transaction execution order between connections exactly matches the capture sequence. This might lead to incorrect error reports.
137
+
> - TiProxy does not automatically delete the previous replay report when replaying traffic. You need to manually delete it.
102
138
103
139
## Test throughput
104
140
@@ -151,3 +187,7 @@ For more information, see [`tiproxyctl traffic cancel`](/tiproxy/tiproxy-command
151
187
- TiProxy traffic replay does not support filtering SQL types and DML and DDL statements are replayed. Therefore, you need to restore the cluster data to its pre-replay state before replaying again.
152
188
- TiProxy traffic replay does not support testing [Resource Control](/tidb-resource-control.md) and [privilege management](/privilege-management.md) because TiProxy uses the same username to replay traffic.
153
189
- TiProxy does not support replaying [`LOAD DATA`](/sql-statements/sql-statement-load-data.md) statements.
190
+
191
+
## More resources
192
+
193
+
For more information about the traffic replay of TiProxy, see the [design document](https://github.com/pingcap/tiproxy/blob/main/docs/design/2024-08-27-traffic-replay.md).
0 commit comments