From 640db1a04cc03aa04d89e3c3d8cc5c622bc4cfbc Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fischer@muhq.space>
Date: Mon, 16 May 2022 11:39:59 +0200
Subject: [PATCH] use 99.9 instead of 99.999 percentile

I expect the 99.999 percentile mostly to include extreme latencies
introduced by the experiment setup.
Nearly all flavors show some latencies around ~13500 and ~26000 ms.
---
 plot_tail_latency.py | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/plot_tail_latency.py b/plot_tail_latency.py
index f549484..b856747 100755
--- a/plot_tail_latency.py
+++ b/plot_tail_latency.py
@@ -15,7 +15,7 @@ CSV_FIELDS = {'total': 0, 'after-send': 1, 'after-send-dispatch': 2}
 def get_bar_data(latency_files, latency='total', include_raw_data=False):
 
     field = CSV_FIELDS[latency]
-    prctl = [50, 95, 99, 99.99, 99.999]
+    prctl = [50, 95, 99, 99.9, 99.99]
 
     data = {}
     for latency_file in latency_files:
@@ -29,14 +29,14 @@ def get_bar_data(latency_files, latency='total', include_raw_data=False):
                        usecols=field))
 
         mean = np.mean(ns)
-        median, p95, p99, p99_99, p99_999 = np.percentile(ns, prctl)
+        median, p95, p99, p99_9, p99_99 = np.percentile(ns, prctl)
         data[impl] = {
             'mean': mean,
             'median': median,
             95: p95,
             99: p99,
-            99.99: p99_99,
-            99.999: p99_999
+            99.9: p99_9,
+            99.99: p99_99
         }
 
         if include_raw_data:
@@ -63,17 +63,18 @@ def plot_tail_latency_bar_tikz(latency_files, latency):
     ylabel={latency in ms},
     xlabel={percentiles},
     cycle list name=barvibrant,
-    symbolic x coords={50\\%,95\\%,99\\%,99.99\\%,99.999\\%},
+    symbolic x coords={50\\%,95\\%,99\\%,99.9\\%,99.99\\%},
     xtick=data,
     nodes near coords,
     nodes near coords align={horizontal},
     nodes near coords style={rotate=90},
+    /pgf/number format/.cd,
+        use comma,
+        1000 sep={},
 ]
 """)
 
-    addplot = Template(
-        "\\addplot coordinates {(50\\%, $p50) (95\\%, $p95) (99\\%, $p99) (99.99\\%, $p99_99) (99.999\\%, $p99_999)};"
-    )
+    addplot = "\\addplot coordinates {{(50\\%, {p50:.2f}) (95\\%, {p95:.2f}) (99\\%, {p99:.2f}) (99.9\\%, {p99_9:.2f}) (99.99\\%, {p99_99:.2f})}};"
 
     tail = Template("""\\legend{$labels}
 \\end{axis}
@@ -87,20 +88,20 @@ def plot_tail_latency_bar_tikz(latency_files, latency):
         impl_label = plot_utils.subst_runtime_name(impl)
         labels += f'{impl_label}, '
         # convert to ms
-        p50, p95, p99, p99_99, p99_999 = np.array([
+        p50, p95, p99, p99_9, p99_99 = np.array([
             data['median'],
             data[95],
             data[99],
+            data[99.9],
             data[99.99],
-            data[99.999],
-        ]) // 1000000
+        ]) / 1000000
 
         plots.append(
-            addplot.substitute(p50=p50,
-                               p95=p95,
-                               p99=p99,
-                               p99_99=p99_99,
-                               p99_999=p99_999))
+            addplot.format(p50=p50,
+                           p95=p95,
+                           p99=p99,
+                           p99_9=p99_9,
+                           p99_99=p99_99))
 
     print(preamble.substitute(latency_files=latency_files))
     for plot in plots:
@@ -181,12 +182,12 @@ def summarize(latency_files, latency):
         data = bar_data[impl]
         latencies = data['latencies'] / 1000000
         # convert to ms
-        median, p95, p99, p99_99, p99_999 = np.array([
+        median, p95, p99, p99_9, p99_99 = np.array([
             data['median'],
             data[95],
             data[99],
+            data[99.9],
             data[99.99],
-            data[99.999],
         ]) / 1000000
 
         name = impl.replace('-io', '').replace('emper-',
@@ -200,8 +201,8 @@ def summarize(latency_files, latency):
         print(f'{name}-median: {median:.2f}')
         print(f'{name}-p95: {p95:.2f}')
         print(f'{name}-p99: {p99:.2f}')
+        print(f'{name}-p99.9: {p99_9:.2f}')
         print(f'{name}-p99.99: {p99_99:.2f}')
-        print(f'{name}-p99.999: {p99_999:.2f}')
 
         bin_edge_candidates = [
             data_min, median, 100, 500, 1000, 1750, 2500, 5000, 7500, 10000,
-- 
GitLab