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
"""Render the paired maintenance-policy experiment from exported CSV."""
import argparse
import csv
import html
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()))
assert [int(r['max_unflushed_segments']) for r in rows] == [256, 4096, 4096, 256]
assert all(r['rate'] == '5000' and r['seconds'] == '60' and r['seed_count'] == '1000000'
and r['verified_pairs'] == '1030000' and r['failed'] == '0' for r in rows)
svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="768" height="720" viewBox="0 0 768 720">',
'<rect width="768" height="720" 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>')
text(28, 38, 'Flush policy and foreground write stalls', 25)
text(28, 68, '1 million initial pairs · 5k membership requests/sec · 10% novel')
text(28, 94, '60 seconds/trial · 100 varied pages/sec · 4 MiB memtable limit', 15)
left, width = 195, 445
for panel, (title, maximum, step) in enumerate([
('Write acknowledgement p99 (seconds)', 3, .5),
('Total maintenance time (seconds)', 22, 5),
]):
top = 137 + panel * 234
text(28, top, title, 19)
for i in range(int(maximum / step) + 1):
tick = i * step
x = left + tick / maximum * width
svg.append(f'<line x1="{x}" x2="{x}" y1="{top+16}" y2="{top+170}" stroke="#dce2eb"/>')
text(x, top + 191, f'{tick:g}', 13, 'text-anchor="middle"')
for i, row in enumerate(rows):
y = top + 25 + i * 38
text(28, y + 17, f"{row['max_unflushed_segments']} cap · trial {i+1}", 15)
segments = [('ack_p99_ns', '#bd5313')] if panel == 0 else [
('flush_ns', '#2563eb'), ('compact_ns', '#bd5313'), ('collect_ns', '#64748b')]
x = left
for key, color in segments:
bar = int(row[key]) / 1e9 / maximum * width
svg.append(f'<rect x="{x}" y="{y}" width="{bar}" height="23" fill="{color}"/>')
x += bar
value = int(row['ack_p99_ns' if panel == 0 else 'adapter_maintenance_ns']) / 1e9
text(657, y + 17, f'{value:.2f}')
for x, label, color in [(195, 'Flush', '#2563eb'), (305, 'Compaction', '#bd5313'), (465, 'Collection', '#64748b')]:
svg.append(f'<rect x="{x}" y="584" width="15" height="15" fill="{color}"/>')
text(x + 22, 598, label, 14)
text(28, 639, 'Larger flushes reduce repeated work; multi-second write stalls remain.', 16)
text(28, 665, 'Latency includes queueing from planned arrival. All 300k requests verified/trial.', 14)
text(28, 691, 'Index-only on Fly: 2 performance CPUs, 4 GiB RAM, ext4 volume. Not relay capacity.', 14)
svg.append('</svg>')
args.output.write_text('\n'.join(svg) + '\n')