Files
mtusi2026lab5/evidence/track1.html
T

360 lines
28 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lab5 track 1 — очередь под перегрузкой</title>
<style>
:root { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; padding: 28px; font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: #0f172a; background: #f8fafc; }
main { max-width: 980px; margin: 0 auto; }
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
p.lead { color: #475569; margin: 0 0 18px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 18px;
box-shadow: 0 1px 2px rgba(15,23,42,.04); margin: 0 0 16px; }
.hypothesis { border-left: 4px solid #0284c7; }
.hypothesis strong { color: #075985; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.metric { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; }
.metric .value { font-size: 22px; font-weight: 700; }
.metric .label { color: #64748b; font-size: 13px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: right; padding: 8px 9px; border-bottom: 1px solid #e2e8f0; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { color: #475569; font-weight: 600; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.ok { color: #047857; font-weight: 700; }
.blocked { color: #b91c1c; font-weight: 700; }
.chart { padding: 10px 12px 4px; }
svg { width: 100%; height: auto; display: block; }
.chart-title { font-size: 17px; font-weight: 700; fill: #0f172a; }
.chart-sub { font-size: 12px; fill: #64748b; }
.axis { font-size: 11px; fill: #475569; }
.bar-label { font-size: 10px; fill: #0f172a; font-weight: 600; }
.grid { stroke: #e2e8f0; stroke-width: 1; }
ul { margin: 8px 0 0; padding-left: 22px; }
li { margin: 5px 0; }
.note { color: #475569; font-size: 13px; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
@media (max-width: 640px) {
body { padding: 16px; }
.card { padding: 12px; }
table { font-size: 12px; }
}
</style>
</head>
<body>
<main>
<h1>Lab5, трек 1: очередь под перегрузкой</h1>
<p class="lead">Сгенерировано 2026-11-20T16:02:07.856909+00:00. Стенд: http://172.18.0.1:8080,
4 CPU, Docker 5.6.1.</p>
<section class="card hypothesis">
<strong>Гипотеза.</strong> Стоимость задания складывается из decode, масштабирования
и сжатия. <em>exactly_right</em> (1280×1280) не масштабирует optimized-вариант,
поэтому показывает нижнюю границу стоимости сжатия; <em>huge_few</em> добавляет
downscale, а <em>small_many</em> почти не масштабируется, но и пикселей в нём
мало. Большие изображения при том же числе worker-ов увеличивают очередь,
p95 time-to-ready и RSS. Одновременно проверяем компромисс: <em>eager</em>
уменьшает ожидание, но повышает память; <em>serial</em> экономит память, но
ограничивает throughput.
</section>
<section class="card">
<h2>Профили и сценарии</h2>
<table>
<thead><tr><th>Профиль</th><th>Concurrency</th><th>Prefetch</th><th>Смысл</th></tr></thead>
<tbody>
<tr><td>serial</td><td>1</td><td>1</td><td style='text-align:left'>one job at a time; minimum memory, maximum queueing</td></tr><tr><td>balanced</td><td>4</td><td>4</td><td style='text-align:left'>moderate in-process parallelism and broker window</td></tr><tr><td>eager</td><td>8</td><td>32</td><td style='text-align:left'>wide broker window; highest memory, lowest latency</td></tr>
</tbody>
</table>
<p class="note">Сценарии:
small_many — 192×128, 30 jobs, many small images; almost no scaling; exactly_right — 1280×1280, 18 jobs, largest variant encodes at native 1280, so no scaling on the WebP path; huge_few — 2400×1800, 12 jobs, few 4.32 MP images; optimized variant must scale down to 1280.</p>
</section>
<section class="card">
<h2>Ключевые числа</h2>
<div class="metrics">
<div class="metric"><div class="value">9</div><div class="label">прогонов матрицы</div></div>
<div class="metric"><div class="value">950 MiB</div><div class="label">максимальный RSS worker</div></div>
<div class="metric"><div class="value">7.7 s</div><div class="label">восстановление после backpressure</div></div>
</div>
</section>
<section class="card chart"><svg viewBox="0 0 760 320" role="img" aria-label="Throughput: готовые задания в секунду">
<text x="64" y="24" class="chart-title">Throughput: готовые задания в секунду</text>
<text x="64" y="42" class="chart-sub">Чем выше, тем быстрее pipeline обрабатывает очередь.</text>
<line x1="64" y1="258.0" x2="740" y2="258.0" class="grid"/>
<text x="54" y="262.0" class="axis" text-anchor="end">0 jobs/s</text>
<line x1="64" y1="206.5" x2="740" y2="206.5" class="grid"/>
<text x="54" y="210.5" class="axis" text-anchor="end">5 jobs/s</text>
<line x1="64" y1="155.0" x2="740" y2="155.0" class="grid"/>
<text x="54" y="159.0" class="axis" text-anchor="end">9 jobs/s</text>
<line x1="64" y1="103.5" x2="740" y2="103.5" class="grid"/>
<text x="54" y="107.5" class="axis" text-anchor="end">14 jobs/s</text>
<line x1="64" y1="52.0" x2="740" y2="52.0" class="grid"/>
<text x="54" y="56.0" class="axis" text-anchor="end">18 jobs/s</text>
<rect x="83.2" y="181.4" width="45.1" height="76.6" fill="#64748b" rx="3"/>
<text x="105.8" y="176.4" class="bar-label" text-anchor="middle">6.84 jobs/s</text>
<rect x="138.2" y="104.5" width="45.1" height="153.5" fill="#0284c7" rx="3"/>
<text x="160.7" y="99.5" class="bar-label" text-anchor="middle">13.69 jobs/s</text>
<rect x="193.2" y="83.4" width="45.1" height="174.6" fill="#f59e0b" rx="3"/>
<text x="215.7" y="78.4" class="bar-label" text-anchor="middle">15.58 jobs/s</text>
<text x="176.7" y="282" class="axis" text-anchor="middle">small_many</text>
<rect x="308.6" y="252.7" width="45.1" height="5.3" fill="#64748b" rx="3"/>
<text x="331.1" y="247.7" class="bar-label" text-anchor="middle">0.47 jobs/s</text>
<rect x="363.5" y="252.5" width="45.1" height="5.5" fill="#0284c7" rx="3"/>
<text x="386.1" y="247.5" class="bar-label" text-anchor="middle">0.49 jobs/s</text>
<rect x="418.5" y="252.5" width="45.1" height="5.5" fill="#f59e0b" rx="3"/>
<text x="441.0" y="247.5" class="bar-label" text-anchor="middle">0.49 jobs/s</text>
<text x="402.0" y="282" class="axis" text-anchor="middle">exactly_right</text>
<rect x="533.9" y="253.1" width="45.1" height="4.9" fill="#64748b" rx="3"/>
<text x="556.4" y="248.1" class="bar-label" text-anchor="middle">0.44 jobs/s</text>
<rect x="588.9" y="253.1" width="45.1" height="4.9" fill="#0284c7" rx="3"/>
<text x="611.4" y="248.1" class="bar-label" text-anchor="middle">0.44 jobs/s</text>
<rect x="643.8" y="253.0" width="45.1" height="5.0" fill="#f59e0b" rx="3"/>
<text x="666.4" y="248.0" class="bar-label" text-anchor="middle">0.44 jobs/s</text>
<text x="627.3" y="282" class="axis" text-anchor="middle">huge_few</text>
<rect x="64" y="298" width="11" height="11" fill="#64748b" rx="2"/>
<text x="80" y="308" class="axis">serial</text>
<rect x="154" y="298" width="11" height="11" fill="#0284c7" rx="2"/>
<text x="170" y="308" class="axis">balanced</text>
<rect x="244" y="298" width="11" height="11" fill="#f59e0b" rx="2"/>
<text x="260" y="308" class="axis">eager</text>
<text x="740" y="308" class="axis" text-anchor="end">higher is better</text>
</svg></section>
<section class="card chart"><svg viewBox="0 0 760 320" role="img" aria-label="p95 time-to-ready: от 202 до ready">
<text x="64" y="24" class="chart-title">p95 time-to-ready: от 202 до ready</text>
<text x="64" y="42" class="chart-sub">95% заданий стали ready быстрее этого времени (меньше — лучше).</text>
<line x1="64" y1="258.0" x2="740" y2="258.0" class="grid"/>
<text x="54" y="262.0" class="axis" text-anchor="end">0 ms</text>
<line x1="64" y1="206.5" x2="740" y2="206.5" class="grid"/>
<text x="54" y="210.5" class="axis" text-anchor="end">10560 ms</text>
<line x1="64" y1="155.0" x2="740" y2="155.0" class="grid"/>
<text x="54" y="159.0" class="axis" text-anchor="end">21120 ms</text>
<line x1="64" y1="103.5" x2="740" y2="103.5" class="grid"/>
<text x="54" y="107.5" class="axis" text-anchor="end">31680 ms</text>
<line x1="64" y1="52.0" x2="740" y2="52.0" class="grid"/>
<text x="54" y="56.0" class="axis" text-anchor="end">42240 ms</text>
<rect x="83.2" y="241.7" width="45.1" height="16.3" fill="#64748b" rx="3"/>
<text x="105.8" y="236.7" class="bar-label" text-anchor="middle">3338 ms</text>
<rect x="138.2" y="251.8" width="45.1" height="6.2" fill="#0284c7" rx="3"/>
<text x="160.7" y="246.8" class="bar-label" text-anchor="middle">1274 ms</text>
<rect x="193.2" y="252.3" width="45.1" height="5.7" fill="#f59e0b" rx="3"/>
<text x="215.7" y="247.3" class="bar-label" text-anchor="middle">1166 ms</text>
<text x="176.7" y="282" class="axis" text-anchor="middle">small_many</text>
<rect x="308.6" y="83.8" width="45.1" height="174.2" fill="#64748b" rx="3"/>
<text x="331.1" y="78.8" class="bar-label" text-anchor="middle">35714 ms</text>
<rect x="363.5" y="83.6" width="45.1" height="174.4" fill="#0284c7" rx="3"/>
<text x="386.1" y="78.6" class="bar-label" text-anchor="middle">35764 ms</text>
<rect x="418.5" y="83.4" width="45.1" height="174.6" fill="#f59e0b" rx="3"/>
<text x="441.0" y="78.4" class="bar-label" text-anchor="middle">35797 ms</text>
<text x="402.0" y="282" class="axis" text-anchor="middle">exactly_right</text>
<rect x="533.9" y="131.7" width="45.1" height="126.3" fill="#64748b" rx="3"/>
<text x="556.4" y="126.7" class="bar-label" text-anchor="middle">25896 ms</text>
<rect x="588.9" y="128.4" width="45.1" height="129.6" fill="#0284c7" rx="3"/>
<text x="611.4" y="123.4" class="bar-label" text-anchor="middle">26576 ms</text>
<rect x="643.8" y="128.1" width="45.1" height="129.9" fill="#f59e0b" rx="3"/>
<text x="666.4" y="123.1" class="bar-label" text-anchor="middle">26641 ms</text>
<text x="627.3" y="282" class="axis" text-anchor="middle">huge_few</text>
<rect x="64" y="298" width="11" height="11" fill="#64748b" rx="2"/>
<text x="80" y="308" class="axis">serial</text>
<rect x="154" y="298" width="11" height="11" fill="#0284c7" rx="2"/>
<text x="170" y="308" class="axis">balanced</text>
<rect x="244" y="298" width="11" height="11" fill="#f59e0b" rx="2"/>
<text x="260" y="308" class="axis">eager</text>
<text x="740" y="308" class="axis" text-anchor="end">lower is better</text>
</svg></section>
<section class="card chart"><svg viewBox="0 0 760 320" role="img" aria-label="p95 queue lag: ожидание до старта обработки">
<text x="64" y="24" class="chart-title">p95 queue lag: ожидание до старта обработки</text>
<text x="64" y="42" class="chart-sub">Время между durable 202 и первым claim worker-а (меньше — лучше).</text>
<line x1="64" y1="258.0" x2="740" y2="258.0" class="grid"/>
<text x="54" y="262.0" class="axis" text-anchor="end">0 ms</text>
<line x1="64" y1="206.5" x2="740" y2="206.5" class="grid"/>
<text x="54" y="210.5" class="axis" text-anchor="end">9909 ms</text>
<line x1="64" y1="155.0" x2="740" y2="155.0" class="grid"/>
<text x="54" y="159.0" class="axis" text-anchor="end">19819 ms</text>
<line x1="64" y1="103.5" x2="740" y2="103.5" class="grid"/>
<text x="54" y="107.5" class="axis" text-anchor="end">29728 ms</text>
<line x1="64" y1="52.0" x2="740" y2="52.0" class="grid"/>
<text x="54" y="56.0" class="axis" text-anchor="end">39637 ms</text>
<rect x="83.2" y="241.1" width="45.1" height="16.9" fill="#64748b" rx="3"/>
<text x="105.8" y="236.1" class="bar-label" text-anchor="middle">3256 ms</text>
<rect x="138.2" y="252.0" width="45.1" height="6.0" fill="#0284c7" rx="3"/>
<text x="160.7" y="247.0" class="bar-label" text-anchor="middle">1147 ms</text>
<rect x="193.2" y="253.2" width="45.1" height="4.8" fill="#f59e0b" rx="3"/>
<text x="215.7" y="248.2" class="bar-label" text-anchor="middle">924 ms</text>
<text x="176.7" y="282" class="axis" text-anchor="middle">small_many</text>
<rect x="308.6" y="83.4" width="45.1" height="174.6" fill="#64748b" rx="3"/>
<text x="331.1" y="78.4" class="bar-label" text-anchor="middle">33591 ms</text>
<rect x="363.5" y="94.2" width="45.1" height="163.8" fill="#0284c7" rx="3"/>
<text x="386.1" y="89.2" class="bar-label" text-anchor="middle">31510 ms</text>
<rect x="418.5" y="93.1" width="45.1" height="164.9" fill="#f59e0b" rx="3"/>
<text x="441.0" y="88.1" class="bar-label" text-anchor="middle">31735 ms</text>
<text x="402.0" y="282" class="axis" text-anchor="middle">exactly_right</text>
<rect x="533.9" y="135.0" width="45.1" height="123.0" fill="#64748b" rx="3"/>
<text x="556.4" y="130.0" class="bar-label" text-anchor="middle">23668 ms</text>
<rect x="588.9" y="163.6" width="45.1" height="94.4" fill="#0284c7" rx="3"/>
<text x="611.4" y="158.6" class="bar-label" text-anchor="middle">18161 ms</text>
<rect x="643.8" y="166.3" width="45.1" height="91.7" fill="#f59e0b" rx="3"/>
<text x="666.4" y="161.3" class="bar-label" text-anchor="middle">17648 ms</text>
<text x="627.3" y="282" class="axis" text-anchor="middle">huge_few</text>
<rect x="64" y="298" width="11" height="11" fill="#64748b" rx="2"/>
<text x="80" y="308" class="axis">serial</text>
<rect x="154" y="298" width="11" height="11" fill="#0284c7" rx="2"/>
<text x="170" y="308" class="axis">balanced</text>
<rect x="244" y="298" width="11" height="11" fill="#f59e0b" rx="2"/>
<text x="260" y="308" class="axis">eager</text>
<text x="740" y="308" class="axis" text-anchor="end">lower is better</text>
</svg></section>
<section class="card chart"><svg viewBox="0 0 760 320" role="img" aria-label="Пиковый RSS worker">
<text x="64" y="24" class="chart-title">Пиковый RSS worker</text>
<text x="64" y="42" class="chart-sub">VmRSS процесса worker во время задания (меньше — экономнее).</text>
<line x1="64" y1="258.0" x2="740" y2="258.0" class="grid"/>
<text x="54" y="262.0" class="axis" text-anchor="end">0 MiB</text>
<line x1="64" y1="206.5" x2="740" y2="206.5" class="grid"/>
<text x="54" y="210.5" class="axis" text-anchor="end">280 MiB</text>
<line x1="64" y1="155.0" x2="740" y2="155.0" class="grid"/>
<text x="54" y="159.0" class="axis" text-anchor="end">560 MiB</text>
<line x1="64" y1="103.5" x2="740" y2="103.5" class="grid"/>
<text x="54" y="107.5" class="axis" text-anchor="end">840 MiB</text>
<line x1="64" y1="52.0" x2="740" y2="52.0" class="grid"/>
<text x="54" y="56.0" class="axis" text-anchor="end">1121 MiB</text>
<rect x="83.2" y="252.8" width="45.1" height="5.2" fill="#64748b" rx="3"/>
<text x="105.8" y="247.8" class="bar-label" text-anchor="middle">28 MiB</text>
<rect x="138.2" y="252.7" width="45.1" height="5.3" fill="#0284c7" rx="3"/>
<text x="160.7" y="247.7" class="bar-label" text-anchor="middle">29 MiB</text>
<rect x="193.2" y="252.1" width="45.1" height="5.9" fill="#f59e0b" rx="3"/>
<text x="215.7" y="247.1" class="bar-label" text-anchor="middle">32 MiB</text>
<text x="176.7" y="282" class="axis" text-anchor="middle">small_many</text>
<rect x="308.6" y="226.0" width="45.1" height="32.0" fill="#64748b" rx="3"/>
<text x="331.1" y="221.0" class="bar-label" text-anchor="middle">174 MiB</text>
<rect x="363.5" y="178.2" width="45.1" height="79.8" fill="#0284c7" rx="3"/>
<text x="386.1" y="173.2" class="bar-label" text-anchor="middle">434 MiB</text>
<rect x="418.5" y="107.5" width="45.1" height="150.5" fill="#f59e0b" rx="3"/>
<text x="441.0" y="102.5" class="bar-label" text-anchor="middle">818 MiB</text>
<text x="402.0" y="282" class="axis" text-anchor="middle">exactly_right</text>
<rect x="533.9" y="218.9" width="45.1" height="39.1" fill="#64748b" rx="3"/>
<text x="556.4" y="213.9" class="bar-label" text-anchor="middle">213 MiB</text>
<rect x="588.9" y="118.9" width="45.1" height="139.1" fill="#0284c7" rx="3"/>
<text x="611.4" y="113.9" class="bar-label" text-anchor="middle">756 MiB</text>
<rect x="643.8" y="83.4" width="45.1" height="174.6" fill="#f59e0b" rx="3"/>
<text x="666.4" y="78.4" class="bar-label" text-anchor="middle">950 MiB</text>
<text x="627.3" y="282" class="axis" text-anchor="middle">huge_few</text>
<rect x="64" y="298" width="11" height="11" fill="#64748b" rx="2"/>
<text x="80" y="308" class="axis">serial</text>
<rect x="154" y="298" width="11" height="11" fill="#0284c7" rx="2"/>
<text x="170" y="308" class="axis">balanced</text>
<rect x="244" y="298" width="11" height="11" fill="#f59e0b" rx="2"/>
<text x="260" y="308" class="axis">eager</text>
<text x="740" y="308" class="axis" text-anchor="end">lower is better</text>
</svg></section>
<section class="card chart"><svg viewBox="0 0 760 320" role="img" aria-label="Compression overhead: доля encode в pipeline CPU">
<text x="64" y="24" class="chart-title">Compression overhead: доля encode в pipeline CPU</text>
<text x="64" y="42" class="chart-sub">encode / (decode + scale + encode), % (меньше — дешевле сжатие).</text>
<line x1="64" y1="258.0" x2="740" y2="258.0" class="grid"/>
<text x="54" y="262.0" class="axis" text-anchor="end">0 %</text>
<line x1="64" y1="206.5" x2="740" y2="206.5" class="grid"/>
<text x="54" y="210.5" class="axis" text-anchor="end">25 %</text>
<line x1="64" y1="155.0" x2="740" y2="155.0" class="grid"/>
<text x="54" y="159.0" class="axis" text-anchor="end">49 %</text>
<line x1="64" y1="103.5" x2="740" y2="103.5" class="grid"/>
<text x="54" y="107.5" class="axis" text-anchor="end">74 %</text>
<line x1="64" y1="52.0" x2="740" y2="52.0" class="grid"/>
<text x="54" y="56.0" class="axis" text-anchor="end">99 %</text>
<rect x="83.2" y="83.4" width="45.1" height="174.6" fill="#64748b" rx="3"/>
<text x="105.8" y="78.4" class="bar-label" text-anchor="middle">83.8 %</text>
<rect x="138.2" y="83.4" width="45.1" height="174.6" fill="#0284c7" rx="3"/>
<text x="160.7" y="78.4" class="bar-label" text-anchor="middle">83.8 %</text>
<rect x="193.2" y="91.5" width="45.1" height="166.5" fill="#f59e0b" rx="3"/>
<text x="215.7" y="86.5" class="bar-label" text-anchor="middle">79.9 %</text>
<text x="176.7" y="282" class="axis" text-anchor="middle">small_many</text>
<rect x="308.6" y="87.2" width="45.1" height="170.8" fill="#64748b" rx="3"/>
<text x="331.1" y="82.2" class="bar-label" text-anchor="middle">82.0 %</text>
<rect x="363.5" y="84.9" width="45.1" height="173.1" fill="#0284c7" rx="3"/>
<text x="386.1" y="79.9" class="bar-label" text-anchor="middle">83.1 %</text>
<rect x="418.5" y="84.9" width="45.1" height="173.1" fill="#f59e0b" rx="3"/>
<text x="441.0" y="79.9" class="bar-label" text-anchor="middle">83.1 %</text>
<text x="402.0" y="282" class="axis" text-anchor="middle">exactly_right</text>
<rect x="533.9" y="125.1" width="45.1" height="132.9" fill="#64748b" rx="3"/>
<text x="556.4" y="120.1" class="bar-label" text-anchor="middle">63.8 %</text>
<rect x="588.9" y="130.1" width="45.1" height="127.9" fill="#0284c7" rx="3"/>
<text x="611.4" y="125.1" class="bar-label" text-anchor="middle">61.4 %</text>
<rect x="643.8" y="130.1" width="45.1" height="127.9" fill="#f59e0b" rx="3"/>
<text x="666.4" y="125.1" class="bar-label" text-anchor="middle">61.4 %</text>
<text x="627.3" y="282" class="axis" text-anchor="middle">huge_few</text>
<rect x="64" y="298" width="11" height="11" fill="#64748b" rx="2"/>
<text x="80" y="308" class="axis">serial</text>
<rect x="154" y="298" width="11" height="11" fill="#0284c7" rx="2"/>
<text x="170" y="308" class="axis">balanced</text>
<rect x="244" y="298" width="11" height="11" fill="#f59e0b" rx="2"/>
<text x="260" y="308" class="axis">eager</text>
<text x="740" y="308" class="axis" text-anchor="end">lower is better</text>
</svg></section>
<section class="card">
<h2>Полная матрица</h2>
<table>
<thead><tr><th>Профиль</th><th>Сценарий</th><th>Jobs</th><th>Jobs/s</th><th>Queue lag p95, ms</th><th>Ready p95, ms</th><th>Processing p95, ms</th><th>Encode p95, ms</th><th>Encode share, %</th><th>RSS peak, MiB</th><th>Max parallel</th><th>Max backlog</th></tr></thead>
<tbody><tr><td>serial</td><td>small_many</td><td>30</td><td>6.84</td><td>3256</td><td>3338</td><td>170</td><td>80</td><td>83.8</td><td>28</td><td>1</td><td>27</td></tr><tr><td>serial</td><td>exactly_right</td><td>18</td><td>0.47</td><td>33591</td><td>35714</td><td>2180</td><td>1722</td><td>82.0</td><td>174</td><td>1</td><td>18</td></tr><tr><td>serial</td><td>huge_few</td><td>12</td><td>0.44</td><td>23668</td><td>25896</td><td>2359</td><td>1508</td><td>63.8</td><td>213</td><td>1</td><td>12</td></tr><tr><td>balanced</td><td>small_many</td><td>30</td><td>13.69</td><td>1147</td><td>1274</td><td>396</td><td>90</td><td>83.8</td><td>29</td><td>4</td><td>24</td></tr><tr><td>balanced</td><td>exactly_right</td><td>18</td><td>0.49</td><td>31510</td><td>35764</td><td>8174</td><td>6562</td><td>83.1</td><td>434</td><td>4</td><td>18</td></tr><tr><td>balanced</td><td>huge_few</td><td>12</td><td>0.44</td><td>18161</td><td>26576</td><td>9046</td><td>5606</td><td>61.4</td><td>756</td><td>4</td><td>12</td></tr><tr><td>eager</td><td>small_many</td><td>30</td><td>15.58</td><td>924</td><td>1166</td><td>410</td><td>95</td><td>79.9</td><td>32</td><td>8</td><td>22</td></tr><tr><td>eager</td><td>exactly_right</td><td>18</td><td>0.49</td><td>31735</td><td>35797</td><td>16363</td><td>13330</td><td>83.1</td><td>818</td><td>8</td><td>18</td></tr><tr><td>eager</td><td>huge_few</td><td>12</td><td>0.44</td><td>17648</td><td>26641</td><td>17678</td><td>11124</td><td>61.4</td><td>950</td><td>8</td><td>12</td></tr></tbody>
</table>
<p class="note">Queue lag = <code>processing_started_at - created_at</code>.
Time-to-ready = <code>finished_at - created_at</code>. Processing = <code>finished_at - processing_started_at</code>.
Encode = JPEG thumbnail + JPEG crop + WebP optimized; encode share =
<code>encode / (decode + scale + encode)</code> из worker-лога.
Суммы байт вариантов и оригинала остаются в JSON, но не выносятся в заголовок:
синтетический PNG сжимается слишком хорошо, чтобы отношение байт было честной
метрикой эффективности кодека.
RSS — VmRSS процесса worker, сэмплирование примерно каждые 100 мс.
Max parallel — максимум одновременно обрабатываемых заданий; max backlog —
максимум принятых, но ещё не готовых заданий.</p>
</section>
<section class="card">
<h2>Backpressure и восстановление</h2>
<p>Перед этим прогоном API пересоздан с <code>MAX_PENDING_JOBS=3</code>, worker
остановлен. Cap выбран намеренно: важно не число принятых заданий, а то, что
API возвращает <code>503</code> с <code>Retry-After</code> и не теряет уже
подтверждённую работу. Затем worker запускается, принятые задания должны дойти
до ready.</p>
<table>
<thead><tr><th>#</th><th>HTTP</th><th>Latency, ms</th><th>Retry-After</th><th>Error code</th></tr></thead>
<tbody><tr><td>1</td><td class="ok">202</td><td>26.7</td><td>—</td><td>—</td></tr><tr><td>2</td><td class="ok">202</td><td>20.3</td><td>—</td><td>—</td></tr><tr><td>3</td><td class="ok">202</td><td>13.8</td><td>—</td><td>—</td></tr><tr><td>4</td><td class="blocked">503</td><td>2.4</td><td>5</td><td>unavailable</td></tr></tbody>
</table>
<p class="note">Recovery: 3 принятых заданий
стали ready за 7.65 с после старта worker.
Финальный probe upload: HTTP 202 → ready.</p>
</section>
<section class="card">
<h2>Что это значит</h2>
<ul><li>small_many: eager быстрее serial в 2.3× по throughput.</li><li>small_many: пиковый RSS eager относится к serial как 1.1×.</li><li>exactly_right: throughput eager и serial практически одинаков.</li><li>exactly_right: пиковый RSS eager относится к serial как 4.7×.</li><li>huge_few: throughput eager и serial практически одинаков.</li><li>huge_few: пиковый RSS eager относится к serial как 4.5×.</li><li>При balanced p95 time-to-ready для huge_few в 20.9× больше, чем для small_many: размер изображения меняет стоимость задания, а не только число заданий.</li><li>Compression vs scaling (balanced): exactly_right — encode share 83.1%, scale p95 1527 ms; huge_few — encode share 61.4%, scale p95 3448 ms. На exactly_right optimized WebP кодируется в native 1280, поэтому это нижняя граница стоимости сжатия; на huge_few к ней добавляется downscale.</li><li>На huge_few eager почти не поднял throughput (1.02×): worker ограничен 1.0 CPU, а декодирование и масштабирование упираются в CPU. Concurrency снижает queue lag, но при этом растёт RSS; это и есть компромисс latency/ресурсы, а не бесплатное ускорение.</li><li>serial ограничивает одновременно обрабатываемые задания одним, поэтому queue lag растёт, но RSS остаётся минимальным. eager держит больше заданий в работе и в prefetch-окне брокера.</li><li>Backpressure: cap=3 выставлен намеренно, поэтому число принятых заданий — следствие настройки, а не открытие. Значимо то, что API вернул 503 с Retry-After=5, а после старта worker очередь восстановилась за 7.7 с.</li></ul>
</section>
<section class="card">
<h2>Ограничения</h2>
<ul>
<li>Один worker, один RabbitMQ и один PostgreSQL: это сравнение настроек, а не
HA-кластер. Числа зависят от CPU/диска конкретной машины.</li>
<li>PNG-фикстуры синтетические и хорошо сжимаются; absolute encode time зависит
от паттерна, но сравнение сценариев при одном паттерне остаётся корректным.
Размер в байтах указан в JSON.</li>
<li>Timing-поля читаются из worker-лога. Это wall-clock внутри процесса, поэтому
при concurrency &gt; 1 в них входит и планировщик, что как раз и нужно для
сравнения профилей.</li>
<li>exactly_right кодирует 1.64 MP WebP, а huge_few после downscale — около
1.23 MP. Сценарий убирает scaling, но не уравнивает объём encode; это указано,
чтобы не сравнивать throughput как «одинаковую работу».</li>
<li>RSS сэмплируется из <code>/proc/1/status</code>; короткий прогон не заменяет
длительный memory profile и p99.</li>
<li>Backpressure cap приблизительный: каждая API-реплика считает pending-задания
по общей БД, но проверка и вставка не являются одной транзакцией.</li>
</ul>
</section>
</main>
</body>
</html>