"""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 = ['', '', ''] def text(x, y, value, size=16, extra=''): svg.append(f'{html.escape(value)}') 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'') 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'') 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'') 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('') args.output.write_text('\n'.join(svg) + '\n')