This is an automated email from the ASF dual-hosted git repository.

wangjian pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 730ae6405c feat: add P99.9 latency percentile to benchmark CLI (#8014)
730ae6405c is described below

commit 730ae6405c98c5b919093fa7ee69ab281f4a44fd
Author: Mason.Chen <[email protected]>
AuthorDate: Thu Mar 12 15:40:29 2026 +0800

    feat: add P99.9 latency percentile to benchmark CLI (#8014)
---
 changes/en-us/2.x.md                                      |  2 ++
 changes/zh-cn/2.x.md                                      |  1 +
 .../apache/seata/benchmark/model/BenchmarkMetrics.java    | 15 +++++++++++----
 .../apache/seata/benchmark/monitor/MetricsCollector.java  |  2 ++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 6e23c028b9..0c8d4372fc 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -19,6 +19,7 @@ Add changes here for all PR submitted to the 2.x branch.
 <!-- Please add the `changes` to the following 
location(feature/bugfix/optimize/test) based on the type of PR -->
 
 ### feature:
+- [[#8014](https://github.com/apache/incubator-seata/pull/8014)] add P99.9 
latency percentile to benchmark CLI
 - [[#7882](https://github.com/apache/incubator-seata/pull/7882)] add metrics 
for NamingServer
 - [[#7760](https://github.com/apache/incubator-seata/pull/7760)] unify 
Jackson/fastjson serialization
 - [[#7000](https://github.com/apache/incubator-seata/pull/7000)] support 
multi-version codec & fix not returning client registration failure msg.
@@ -65,6 +66,7 @@ Thanks to these contributors for their code commits. Please 
report an unintended
 
 <!-- Please make sure your Github ID is in the list below -->
 
+- [DoChaoing](https://github.com/DoChaoing)
 - [slievrly](https://github.com/slievrly)
 - [contrueCT](https://github.com/contrueCT)
 - [lokidundun](https://github.com/lokidundun)
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 9af251bc57..05f15f89f8 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -25,6 +25,7 @@
 - [[#7000](https://github.com/apache/incubator-seata/pull/7000)] 
支持多版本codec,修复不返回客户端注册失败消息的问题
 - [[#7865](https://github.com/apache/incubator-seata/pull/7865)] 新增 Benchmark 
命令行工具
 - [[#7903](https://github.com/apache/incubator-seata/pull/7903)] 在Server 
Raft模式下支持Watch API的HTTP/2流推送
+- [[#8014](https://github.com/apache/incubator-seata/pull/8014)] 为 benchmark 
CLI 添加 P99.9 尾延迟百分位
 - [[#8002](https://github.com/apache/incubator-seata/pull/8002)] 
为namingserver指标增加Grafana dashboard JSON
 
 ### bugfix:
diff --git 
a/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
 
b/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
index c277481a1f..bc130823cd 100644
--- 
a/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
+++ 
b/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/model/BenchmarkMetrics.java
@@ -121,14 +121,14 @@ public class BenchmarkMetrics {
             return cachedStats;
         }
 
-        synchronized (this) {
+        synchronized (latencies) {
             // Double-check
             if (cachedStats != null && (now - lastStatsUpdateTime) < 
BenchmarkConstants.LATENCY_STATS_CACHE_MS) {
                 return cachedStats;
             }
 
             if (latencies.isEmpty()) {
-                cachedStats = new LatencyStats(0, 0, 0, 0);
+                cachedStats = new LatencyStats(0, 0, 0, 0, 0);
             } else {
                 List<Long> sortedLatencies = new ArrayList<>(latencies);
                 Collections.sort(sortedLatencies);
@@ -137,9 +137,10 @@ public class BenchmarkMetrics {
                 long p50 = sortedLatencies.get(Math.max(0, (int) 
Math.ceil(size * 0.5) - 1));
                 long p95 = sortedLatencies.get(Math.max(0, (int) 
Math.ceil(size * 0.95) - 1));
                 long p99 = sortedLatencies.get(Math.max(0, (int) 
Math.ceil(size * 0.99) - 1));
+                long p999 = sortedLatencies.get(Math.max(0, (int) 
Math.ceil(size * 0.999) - 1));
                 long max = sortedLatencies.get(size - 1);
 
-                cachedStats = new LatencyStats(p50, p95, p99, max);
+                cachedStats = new LatencyStats(p50, p95, p99, p999, max);
             }
 
             lastStatsUpdateTime = now;
@@ -160,12 +161,14 @@ public class BenchmarkMetrics {
         private final long p50;
         private final long p95;
         private final long p99;
+        private final long p999;
         private final long max;
 
-        public LatencyStats(long p50, long p95, long p99, long max) {
+        public LatencyStats(long p50, long p95, long p99, long p999, long max) 
{
             this.p50 = p50;
             this.p95 = p95;
             this.p99 = p99;
+            this.p999 = p999;
             this.max = max;
         }
 
@@ -181,6 +184,10 @@ public class BenchmarkMetrics {
             return p99;
         }
 
+        public long getP999() {
+            return p999;
+        }
+
         public long getMax() {
             return max;
         }
diff --git 
a/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java
 
b/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java
index f74886dcaa..f784b1d884 100644
--- 
a/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java
+++ 
b/test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/monitor/MetricsCollector.java
@@ -53,6 +53,7 @@ public class MetricsCollector {
             writer.println("Latency P50 (ms)," + latency.getP50());
             writer.println("Latency P95 (ms)," + latency.getP95());
             writer.println("Latency P99 (ms)," + latency.getP99());
+            writer.println("Latency P99.9 (ms)," + latency.getP999());
             writer.println("Latency Max (ms)," + latency.getMax());
 
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -83,6 +84,7 @@ public class MetricsCollector {
         report.append(String.format("  P50:                 %d ms\n", 
latency.getP50()));
         report.append(String.format("  P95:                 %d ms\n", 
latency.getP95()));
         report.append(String.format("  P99:                 %d ms\n", 
latency.getP99()));
+        report.append(String.format("  P99.9:               %d ms\n", 
latency.getP999()));
         report.append(String.format("  Max:                 %d ms\n", 
latency.getMax()));
         report.append("===================================================\n");
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to