How to Check the Number of Concurrent Connections During Peak Times in TiDB

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb如何查看系统高峰时的并发数

| username: yeminhua

How to check the number of concurrent connections during peak times in TiDB

| username: 有猫万事足 | Original post link

Concurrency = QPS * Average Response Time

You can directly find the corresponding data on the TiDB dashboard and calculate it. For the average response time, I personally feel that Database Time can be used.

| username: TIDB-Learner | Original post link

show processlist

| username: mono | Original post link

Check the dashboard or Grafana.

| username: zhaokede | Original post link

SHOW STATUS LIKE ‘Threads_running’;

| username: buddyyuan | Original post link

The most direct way is to query the expression tidb_server_tokens in Prometheus, as only this expression represents concurrent connections.

tidb_server_tokens The number of concurrent executing sessions
TYPE tidb_server_tokens gauge
tidb_server_tokens 0

| username: buddyyuan | Original post link

Another way is to check the performance-overview panel, which will display Active connections.

| username: TiDBer_小阿飞 | Original post link

| username: zhanggame1 | Original post link

You can directly view QPS on the dashboard. As for how many connections are running SQL, you can check this:

where t.command<>'Sleep';
| username: 这里介绍不了我 | Original post link

Does the concurrency here refer to the number of connections to the DB or something else?

| username: yeminhua | Original post link

Yes, it’s pretty much as you said. I checked the peak QPS from Grafana, and the average response time is over 1 second, which basically equals the QPS.

| username: yeminhua | Original post link

Finally found it from Grafana, thank you.

| username: yeminhua | Original post link

No, peak concurrency generally refers to qps * average response time.

| username: 这里介绍不了我 | Original post link

I’ve learned a lot.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.