What does latency mean in the dashboard?

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

Original topic: dashboard里面的延迟是什么意思

| username: 舞动梦灵

In the TiDB dashboard, which part of the latency is being referred to? Another set of TiDB has a latency of tens of milliseconds, but this one is 2-8 seconds.

| username: 江湖故人 | Original post link

It’s the execution time.
Sorted by execution time, there are execution times at the 90th, 99th, and 99.9th percentiles.

| username: 舞动梦灵 | Original post link

The average latency of all SQL execution times? Does this latency refer to the network latency of executing SQL?

| username: 江湖故人 | Original post link

It’s not the average, it’s the percentile rank, for example, the median is 50%. Latency is the time from the start of execution to the end of execution, with network latency being just one part of it.

| username: 舞动梦灵 | Original post link

:joy: Bro, I feel like what you’re saying is a bit too technical.
Latency is the total delay from the start of executing the SQL to the end of executing the SQL, right?
What are these ranking percentiles and medians? I don’t quite understand.
Does it mean that 99% of SQL latencies are within this time?

| username: 啦啦啦啦啦 | Original post link

The introduction here is quite detailed; it is actually the percentile value of SQL response time.

| username: tidb菜鸟一只 | Original post link

Here are a few examples. Suppose you have 10,000 queries with varying latencies. What would these three monitoring metrics be?

First, we need to sort the latency times of these 10,000 queries and then find the latency times at the corresponding percentile positions.

  1. 90th percentile: This indicates that 90% of the query latencies are below this value. In this example, 90% of the queries amount to 10,000 * 90% = 9,000 queries. Therefore, the latency time of the 9,000th query is the 90th percentile. Assuming the latency time of the 9,000th query is 2,000 milliseconds, the 90th percentile is 2,000 milliseconds.
  2. 99th percentile: This indicates that 99% of the query latencies are below this value. In this example, 99% of the queries amount to 10,000 * 99% = 9,900 queries. Therefore, the latency time of the 9,900th query is the 99th percentile. Assuming the latency time of the 9,900th query is 5,000 milliseconds, the 99th percentile is 5,000 milliseconds.
  3. 99.9th percentile: This indicates that 99.9% of the query latencies are below this value. In this example, 99.9% of the queries amount to 10,000 * 99.9% = 9,990 queries. Therefore, the latency time of the 9,990th query is the 99.9th percentile. Assuming the latency time of the 9,990th query is 8,000 milliseconds, the 99.9th percentile is 8,000 milliseconds.

Thus, based on this example, we can calculate that the 90th, 99th, and 99.9th percentiles are 2,000 milliseconds, 5,000 milliseconds, and 8,000 milliseconds, respectively.

| username: 江湖故人 | Original post link

The median (which is 50%) of this set of numbers, 1, 2, 2, 3, 4, 7, 9, is 3. It reflects the data distribution pattern and is not the same as the average value :face_with_peeking_eye:
Similarly, 99% means that 99% of the SQL execution times are less than or equal to this value.

In your screenshot, 99.9% being between 2-8 seconds is not too severe, but you should still pay attention to slow SQL.

| username: 舞动梦灵 | Original post link

Okay, thank you.

| username: 舞动梦灵 | Original post link

Thank you, I understand this now.

| username: dba远航 | Original post link

Latency of different metrics

| username: system | Original post link

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