1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""Plot paired allocator controls without treating missing engine telemetry as zero."""
import argparse
import csv
import html
import math
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument('source', type=Path)
parser.add_argument('output', type=Path)
args = parser.parse_args()
rows = list(csv.DictReader(args.source.open()))
engines = [('rocks-sync-c', 'RocksDB synced · C', '#2563eb'),
('rocks-sync-process', 'RocksDB synced · Safe', '#64748b'),
('zkv-c', 'zkv · C', '#bd5313'),
('zkv-process', 'zkv · Safe', '#916233')]
assert len(rows) == 8
assert all(r['verified_pairs'] == '1015000' and r['failed'] == '0'
and r['rate'] == '5000' and r['seconds'] == '30' for r in rows)
svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="768" height="700" viewBox="0 0 768 700">',
'<rect width="768" height="700" fill="white"/>',
'<style>text{font-family:Arial,sans-serif;fill:#172033}</style>']
def text(x, y, value, size=16, extra=''):
svg.append(f'<text x="{x}" y="{y}" font-size="{size}" {extra}>{html.escape(value)}</text>')
def point(x, y, color):
svg.append(f'<circle cx="{x}" cy="{y}" r="5" fill="{color}"/>')
text(26, 38, 'Allocator parity in the relay index', 26)
text(26, 68, '1 million initial pairs · 5k requests/sec · 10% novel · 100 pages/sec', 15)
text(26, 94, '30 seconds/trial · two trials/control · reverse order · unchanged zkv', 15)
text(26, 137, 'Write acknowledgement p99 (ms, logarithmic axis)', 19)
left, width = 217, 365
minimum, maximum = .5, 1200
def log_x(value):
return left + math.log(value / minimum) / math.log(maximum / minimum) * width
for tick in [.5, 1, 10, 100, 1000]:
x = log_x(tick)
svg.append(f'<line x1="{x}" x2="{x}" y1="155" y2="303" stroke="#dce2eb"/>')
text(x, 326, f'{tick:g}', 13, 'text-anchor="middle"')
for i, (engine, label, color) in enumerate(engines):
values = sorted(int(r['ack_p99_ns']) / 1e6 for r in rows if r['engine'] == engine)
assert len(values) == 2
y = 175 + i * 38
text(26, y + 5, label, 15)
a, b = map(log_x, values)
svg.append(f'<line x1="{a}" x2="{b}" y1="{y}" y2="{y}" stroke="{color}" stroke-width="4"/>')
point(a, y, color)
point(b, y, color)
text(605, y + 5, f'{values[0]:.2f}–{values[1]:.2f}', 14)
text(26, 378, 'zkv total adapter maintenance (seconds)', 19)
for tick in [0, 5, 10, 15]:
x = left + tick / 15 * width
svg.append(f'<line x1="{x}" x2="{x}" y1="397" y2="477" stroke="#dce2eb"/>')
text(x, 502, str(tick), 13, 'text-anchor="middle"')
for i, (engine, label, color) in enumerate(engines[2:]):
values = sorted(int(r['adapter_maintenance_ns']) / 1e9 for r in rows if r['engine'] == engine)
y = 419 + i * 39
text(26, y + 5, label, 15)
a, b = [left + v / 15 * width for v in values]
svg.append(f'<line x1="{a}" x2="{b}" y1="{y}" y2="{y}" stroke="{color}" stroke-width="4"/>')
point(a, y, color)
point(b, y, color)
text(605, y + 5, f'{values[0]:.2f}–{values[1]:.2f}', 14)
text(26, 552, 'C matches production zlay. Safe is Zig 0.17 ReleaseSafe process allocation.', 14)
text(26, 580, 'RocksDB internal allocation remains C/C++; controls also select wrapper/runtime allocation.', 13)
text(26, 608, 'Planned-arrival latency includes queueing. zkv flush/compaction/collection included.', 14)
text(26, 636, 'RocksDB background maintenance is not exposed by the adapter timing counters.', 14)
text(26, 670, 'Index-only on Fly: 2 performance CPUs, 4 GiB RAM, ext4. All writes verified after reopen.', 13)
svg.append('</svg>')
args.output.write_text('\n'.join(svg) + '\n')