What does latency mean in the dashboard?

| 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.