pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.93k stars 5.81k forks source link

diagnose: display detailed transaction time #36868

Open cfzjywxk opened 2 years ago

cfzjywxk commented 2 years ago

Enhancement

In the performance overview panel, the color tuning method is introduced, the idea is that if the overall database time could be broken down as clearly as possible then it's straightforward to tell what's the main bottleneck and what should be done to optimize the performance.

From the perspective of OLTP performance tuning, the most common entry is the throughput and latency of transactions. Theoretically, there could be formulas that

database time = client numbers * (txn duration + out-txn client idle time)
txn duration = stmt duration * stmt number + in-txn client idle time

From this, we could add a color-based database time graph to display the combinations of user database time (note it's quite important to distinguish the user-related requests and tasks and internal background jobs and tasks otherwise there could be much noise )from the perspective of transaction duration including both the total statistics and average statistics top-down. For example, the time details could be displayed like this:

With this, it could be much easier to compare two benchmark results and to verify what's the performance difference and why is that.

cfzjywxk commented 2 years ago

/cc @zyguan