forked from mtusi2026/mtusi2026lab5
level 5 track 1 charts
This commit is contained in:
@@ -103,7 +103,13 @@ Worker отдельно от API. Prefetch равен `WORKER_CONCURRENCY` (в
|
||||
|
||||
Затем worker снова остановлен и отправлено 28 крошечных PNG при лимите 20.
|
||||
|
||||
Сырой JSON: [evidence/track1.json](evidence/track1.json). Стенд тот же, что у уровня 4, дата 2026-11-22.
|
||||
Сырой JSON: [evidence/track1.json](evidence/track1.json). Графики собраны из него командой `python scripts/track1_charts.py` (SVG) и лежат рядом как PNG для слайдов. Стенд тот же, что у уровня 4, дата 2026-11-22.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
| prefetch | backlog ready | drain, с | throughput, 1/с | p95 202→ready, с | p95 small / medium / large, с | RSS max, МиБ |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="540" viewBox="0 0 960 540" role="img">
|
||||
<title>Backpressure: часть upload отклонена, пока worker остановлен</title>
|
||||
<rect width="100%" height="100%" fill="#ffffff"/>
|
||||
<text x="48" y="42" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="22" font-weight="500" text-anchor="start">Пока worker остановлен, лишняя работа не принимается</text>
|
||||
<text x="48" y="68" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="start">28 попыток. Лимит queued + processing = 20. После старта принятые дошли до ready</text>
|
||||
<line x1="140" y1="430" x2="820" y2="430" stroke="#e6e6e6"/>
|
||||
<text x="130" y="434" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">0</text>
|
||||
<line x1="140" y1="350" x2="820" y2="350" stroke="#e6e6e6"/>
|
||||
<text x="130" y="354" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">8</text>
|
||||
<line x1="140" y1="270" x2="820" y2="270" stroke="#e6e6e6"/>
|
||||
<text x="130" y="274" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">16</text>
|
||||
<line x1="140" y1="190" x2="820" y2="190" stroke="#e6e6e6"/>
|
||||
<text x="130" y="194" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">24</text>
|
||||
<line x1="140" y1="110" x2="820" y2="110" stroke="#e6e6e6"/>
|
||||
<text x="130" y="114" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">32</text>
|
||||
<line x1="140" y1="110" x2="140" y2="430" stroke="#1c1c1c"/>
|
||||
<line x1="140" y1="430" x2="820" y2="430" stroke="#1c1c1c"/>
|
||||
<rect x="274" y="240" width="72" height="190" fill="#2E7D4F"/>
|
||||
<text x="310" y="264" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">19</text>
|
||||
<text x="310" y="458" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">202 принято</text>
|
||||
<rect x="614" y="340" width="72" height="90" fill="#C05621"/>
|
||||
<text x="650" y="364" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">9</text>
|
||||
<text x="650" y="458" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">429 отклонено</text>
|
||||
<line x1="140" y1="230" x2="820" y2="230" stroke="#5c5c5c" stroke-dasharray="5 4"/>
|
||||
<text x="828" y="234" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="start">лимит 20</text>
|
||||
<text x="36" y="270" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="middle" transform="rotate(-90 36 270)">ответы</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="560" viewBox="0 0 960 560" role="img">
|
||||
<title>p95 времени от 202 до ready по размеру изображения</title>
|
||||
<rect width="100%" height="100%" fill="#ffffff"/>
|
||||
<text x="48" y="42" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="22" font-weight="500" text-anchor="start">p95 времени от ответа 202 до ready</text>
|
||||
<text x="48" y="68" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="start">5 файлов каждого размера. Время включает ожидание, пока worker был остановлен</text>
|
||||
<line x1="90" y1="460" x2="910" y2="460" stroke="#e6e6e6"/>
|
||||
<text x="80" y="464" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">0</text>
|
||||
<line x1="90" y1="388" x2="910" y2="388" stroke="#e6e6e6"/>
|
||||
<text x="80" y="392" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">2</text>
|
||||
<line x1="90" y1="316" x2="910" y2="316" stroke="#e6e6e6"/>
|
||||
<text x="80" y="320" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">4</text>
|
||||
<line x1="90" y1="244" x2="910" y2="244" stroke="#e6e6e6"/>
|
||||
<text x="80" y="248" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">6</text>
|
||||
<line x1="90" y1="172" x2="910" y2="172" stroke="#e6e6e6"/>
|
||||
<text x="80" y="176" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">8</text>
|
||||
<line x1="90" y1="100" x2="910" y2="100" stroke="#e6e6e6"/>
|
||||
<text x="80" y="104" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">10</text>
|
||||
<line x1="90" y1="100" x2="90" y2="460" stroke="#1c1c1c"/>
|
||||
<line x1="90" y1="460" x2="910" y2="460" stroke="#1c1c1c"/>
|
||||
<text x="226.667" y="486" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="middle">128×128</text>
|
||||
<rect x="162.667" y="245.692" width="28" height="214.308" fill="#1F4E79"/>
|
||||
<text x="176.667" y="237.692" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">5.953</text>
|
||||
<rect x="212.667" y="261.928" width="28" height="198.072" fill="#2E7D4F"/>
|
||||
<text x="226.667" y="253.928" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">5.502</text>
|
||||
<rect x="262.667" y="271.72" width="28" height="188.28" fill="#C05621"/>
|
||||
<text x="276.667" y="263.72" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">5.230</text>
|
||||
<text x="500" y="486" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="middle">640×480</text>
|
||||
<rect x="436" y="240.832" width="28" height="219.168" fill="#1F4E79"/>
|
||||
<text x="450" y="232.832" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">6.088</text>
|
||||
<rect x="486" y="255.664" width="28" height="204.336" fill="#2E7D4F"/>
|
||||
<text x="500" y="247.664" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">5.676</text>
|
||||
<rect x="536" y="278.416" width="28" height="181.584" fill="#C05621"/>
|
||||
<text x="550" y="270.416" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">5.044</text>
|
||||
<text x="773.333" y="486" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="middle">2560×1920</text>
|
||||
<rect x="709.333" y="164.944" width="28" height="295.056" fill="#1F4E79"/>
|
||||
<text x="723.333" y="156.944" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">8.196</text>
|
||||
<rect x="759.333" y="184.708" width="28" height="275.292" fill="#2E7D4F"/>
|
||||
<text x="773.333" y="176.708" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">7.647</text>
|
||||
<rect x="809.333" y="194.824" width="28" height="265.176" fill="#C05621"/>
|
||||
<text x="823.333" y="186.824" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="middle">7.366</text>
|
||||
<text x="28" y="280" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="middle" transform="rotate(-90 28 280)">секунды</text>
|
||||
<rect x="90" y="512" width="14" height="14" fill="#1F4E79"/>
|
||||
<text x="110" y="524" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="start">prefetch 1</text>
|
||||
<rect x="240" y="512" width="14" height="14" fill="#2E7D4F"/>
|
||||
<text x="260" y="524" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="start">prefetch 2</text>
|
||||
<rect x="390" y="512" width="14" height="14" fill="#C05621"/>
|
||||
<text x="410" y="524" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="15" font-weight="400" text-anchor="start">prefetch 4</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="560" viewBox="0 0 960 560" role="img">
|
||||
<title>Throughput и RSS worker при prefetch 1, 2 и 4</title>
|
||||
<rect width="100%" height="100%" fill="#ffffff"/>
|
||||
<text x="48" y="42" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="22" font-weight="500" text-anchor="start">Throughput почти не вырос, RSS при prefetch 4 вырос</text>
|
||||
<text x="48" y="68" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="start">15 из 15 файлов стали ready. Память контейнера worker ограничена 512 МиБ</text>
|
||||
<line x1="80" y1="440" x2="460" y2="440" stroke="#e6e6e6"/>
|
||||
<text x="70" y="444" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">0</text>
|
||||
<line x1="80" y1="333.333" x2="460" y2="333.333" stroke="#e6e6e6"/>
|
||||
<text x="70" y="337.333" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">2</text>
|
||||
<line x1="80" y1="226.667" x2="460" y2="226.667" stroke="#e6e6e6"/>
|
||||
<text x="70" y="230.667" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">4</text>
|
||||
<line x1="80" y1="120" x2="460" y2="120" stroke="#e6e6e6"/>
|
||||
<text x="70" y="124" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">6</text>
|
||||
<line x1="80" y1="120" x2="80" y2="440" stroke="#1c1c1c"/>
|
||||
<line x1="80" y1="440" x2="460" y2="440" stroke="#1c1c1c"/>
|
||||
<rect x="107.333" y="184.747" width="72" height="255.253" fill="#1F4E79"/>
|
||||
<text x="143.333" y="208.747" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">4.786</text>
|
||||
<text x="143.333" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 1</text>
|
||||
<rect x="234" y="180.907" width="72" height="259.093" fill="#1F4E79"/>
|
||||
<text x="270" y="204.907" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">4.858</text>
|
||||
<text x="270" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 2</text>
|
||||
<rect x="360.667" y="208.32" width="72" height="231.68" fill="#1F4E79"/>
|
||||
<text x="396.667" y="232.32" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">4.344</text>
|
||||
<text x="396.667" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 4</text>
|
||||
<line x1="530" y1="440" x2="910" y2="440" stroke="#e6e6e6"/>
|
||||
<text x="520" y="444" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">0</text>
|
||||
<line x1="530" y1="360" x2="910" y2="360" stroke="#e6e6e6"/>
|
||||
<text x="520" y="364" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">128</text>
|
||||
<line x1="530" y1="280" x2="910" y2="280" stroke="#e6e6e6"/>
|
||||
<text x="520" y="284" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">256</text>
|
||||
<line x1="530" y1="200" x2="910" y2="200" stroke="#e6e6e6"/>
|
||||
<text x="520" y="204" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">384</text>
|
||||
<line x1="530" y1="120" x2="910" y2="120" stroke="#e6e6e6"/>
|
||||
<text x="520" y="124" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="13" font-weight="400" text-anchor="end">512</text>
|
||||
<line x1="530" y1="120" x2="530" y2="440" stroke="#1c1c1c"/>
|
||||
<line x1="530" y1="440" x2="910" y2="440" stroke="#1c1c1c"/>
|
||||
<rect x="557.333" y="371.062" width="72" height="68.9375" fill="#C05621"/>
|
||||
<text x="593.333" y="395.062" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">110.3</text>
|
||||
<text x="593.333" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 1</text>
|
||||
<rect x="684" y="370.875" width="72" height="69.125" fill="#C05621"/>
|
||||
<text x="720" y="394.875" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">110.6</text>
|
||||
<text x="720" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 2</text>
|
||||
<rect x="810.667" y="267.625" width="72" height="172.375" fill="#C05621"/>
|
||||
<text x="846.667" y="291.625" fill="#ffffff" font-family="Segoe UI, sans-serif" font-size="16" font-weight="500" text-anchor="middle">275.8</text>
|
||||
<text x="846.667" y="468" fill="#1c1c1c" font-family="Segoe UI, sans-serif" font-size="16" font-weight="400" text-anchor="middle">prefetch 4</text>
|
||||
<text x="270" y="104" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="middle">готовых в секунду</text>
|
||||
<text x="720" y="104" fill="#5c5c5c" font-family="Segoe UI, sans-serif" font-size="14" font-weight="400" text-anchor="middle">RSS worker, МиБ</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
@@ -0,0 +1,180 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Draw the track 1 charts from evidence/track1.json. Standard library only."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SOURCE = ROOT / 'evidence' / 'track1.json'
|
||||
OUT = ROOT / 'evidence'
|
||||
|
||||
COLORS = ('#1F4E79', '#2E7D4F', '#C05621')
|
||||
INK = '#1c1c1c'
|
||||
MUTED = '#5c5c5c'
|
||||
GRID = '#e6e6e6'
|
||||
FONT = 'Segoe UI, sans-serif'
|
||||
|
||||
|
||||
def esc(text):
|
||||
return str(text).replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
|
||||
|
||||
def fmt(value):
|
||||
if abs(value - round(value)) < 1e-9:
|
||||
return str(int(round(value)))
|
||||
if abs(value * 10 - round(value * 10)) < 1e-6:
|
||||
return '%.1f' % value
|
||||
return '%.3f' % value
|
||||
|
||||
|
||||
def header(width, height, title):
|
||||
return (
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="%d" height="%d" viewBox="0 0 %d %d" role="img">\n'
|
||||
'<title>%s</title>\n'
|
||||
'<rect width="100%%" height="100%%" fill="#ffffff"/>\n'
|
||||
) % (width, height, width, height, esc(title))
|
||||
|
||||
|
||||
def text(x, y, value, size=14, fill=INK, anchor='start', weight='400', rotate=None):
|
||||
transform = ''
|
||||
if rotate is not None:
|
||||
transform = ' transform="rotate(%g %g %g)"' % (rotate, x, y)
|
||||
return (
|
||||
'<text x="%g" y="%g" fill="%s" font-family="%s" font-size="%d" font-weight="%s" text-anchor="%s"%s>%s</text>\n'
|
||||
% (x, y, fill, FONT, size, weight, anchor, transform, esc(value))
|
||||
)
|
||||
|
||||
|
||||
def ticks(ymax, count):
|
||||
step = ymax / count
|
||||
return [step * i for i in range(count + 1)]
|
||||
|
||||
|
||||
def grouped(parts, box, ymax, tick_values, categories, series):
|
||||
"""series: (name, color, values). One group of bars per category."""
|
||||
left, top, width, height = box
|
||||
bottom = top + height
|
||||
for tick in tick_values:
|
||||
y = bottom - (tick / ymax) * height
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, y, left + width, y, GRID))
|
||||
parts.append(text(left - 10, y + 4, fmt(tick), 13, MUTED, 'end'))
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, top, left, bottom, INK))
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, bottom, left + width, bottom, INK))
|
||||
slot = width / len(categories)
|
||||
bar_w = 28
|
||||
gap = 22
|
||||
group_w = len(series) * bar_w + (len(series) - 1) * gap
|
||||
for index, label in enumerate(categories):
|
||||
origin = left + index * slot + (slot - group_w) / 2
|
||||
parts.append(text(left + index * slot + slot / 2, bottom + 26, label, 15, INK, 'middle'))
|
||||
for series_index, (_name, color, values) in enumerate(series):
|
||||
value = values[index]
|
||||
bar_h = (value / ymax) * height
|
||||
x = origin + series_index * (bar_w + gap)
|
||||
y = bottom - bar_h
|
||||
parts.append('<rect x="%g" y="%g" width="%g" height="%g" fill="%s"/>\n' % (x, y, bar_w, max(bar_h, 0), color))
|
||||
parts.append(text(x + bar_w / 2, y - 8, fmt(value), 13, INK, 'middle'))
|
||||
|
||||
|
||||
def bars(parts, box, ymax, tick_values, categories, values, colors):
|
||||
left, top, width, height = box
|
||||
bottom = top + height
|
||||
for tick in tick_values:
|
||||
y = bottom - (tick / ymax) * height
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, y, left + width, y, GRID))
|
||||
parts.append(text(left - 10, y + 4, fmt(tick), 13, MUTED, 'end'))
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, top, left, bottom, INK))
|
||||
parts.append('<line x1="%g" y1="%g" x2="%g" y2="%g" stroke="%s"/>\n' % (left, bottom, left + width, bottom, INK))
|
||||
slot = width / len(categories)
|
||||
bar_w = 72
|
||||
for index, label in enumerate(categories):
|
||||
value = values[index]
|
||||
bar_h = (value / ymax) * height
|
||||
x = left + index * slot + (slot - bar_w) / 2
|
||||
y = bottom - bar_h
|
||||
parts.append('<rect x="%g" y="%g" width="%g" height="%g" fill="%s"/>\n' % (x, y, bar_w, bar_h, colors[index]))
|
||||
if bar_h >= 36:
|
||||
parts.append(text(x + bar_w / 2, y + 24, fmt(value), 16, '#ffffff', 'middle', '500'))
|
||||
else:
|
||||
parts.append(text(x + bar_w / 2, y - 8, fmt(value), 16, INK, 'middle', '500'))
|
||||
parts.append(text(left + index * slot + slot / 2, bottom + 28, label, 16, INK, 'middle'))
|
||||
|
||||
|
||||
def legend(parts, x, y, series):
|
||||
cursor = x
|
||||
for name, color, _values in series:
|
||||
parts.append('<rect x="%g" y="%g" width="14" height="14" fill="%s"/>\n' % (cursor, y - 12, color))
|
||||
parts.append(text(cursor + 20, y, name, 15))
|
||||
cursor += 150
|
||||
|
||||
|
||||
def write_p95(runs):
|
||||
labels = ('128×128', '640×480', '2560×1920')
|
||||
keys = ('small', 'medium', 'large')
|
||||
series = []
|
||||
for color, run in zip(COLORS, runs):
|
||||
series.append((
|
||||
'prefetch %s' % run['concurrency_prefetch'],
|
||||
color,
|
||||
[run['p95_by_size'][key]['p95_s'] for key in keys],
|
||||
))
|
||||
parts = [header(960, 560, 'p95 времени от 202 до ready по размеру изображения')]
|
||||
parts.append(text(48, 42, 'p95 времени от ответа 202 до ready', 22, INK, 'start', '500'))
|
||||
parts.append(text(48, 68, '5 файлов каждого размера. Время включает ожидание, пока worker был остановлен', 14, MUTED))
|
||||
grouped(parts, (90, 100, 820, 360), 10, ticks(10, 5), labels, series)
|
||||
parts.append(text(28, 280, 'секунды', 14, MUTED, 'middle', '400', -90))
|
||||
legend(parts, 90, 524, series)
|
||||
parts.append('</svg>\n')
|
||||
(OUT / 'track1-p95.svg').write_text(''.join(parts), encoding='utf-8')
|
||||
|
||||
|
||||
def write_tradeoff(runs):
|
||||
labels = ['prefetch %s' % run['concurrency_prefetch'] for run in runs]
|
||||
throughput = [run['throughput_ready_per_s'] for run in runs]
|
||||
rss = [run['rss_max_mib'] for run in runs]
|
||||
parts = [header(960, 560, 'Throughput и RSS worker при prefetch 1, 2 и 4')]
|
||||
parts.append(text(48, 42, 'Throughput почти не вырос, RSS при prefetch 4 вырос', 22, INK, 'start', '500'))
|
||||
parts.append(text(48, 68, '15 из 15 файлов стали ready. Память контейнера worker ограничена 512 МиБ', 14, MUTED))
|
||||
bars(parts, (80, 120, 380, 320), 6, ticks(6, 3), labels, throughput, (COLORS[0], COLORS[0], COLORS[0]))
|
||||
bars(parts, (530, 120, 380, 320), 512, ticks(512, 4), labels, rss, (COLORS[2], COLORS[2], COLORS[2]))
|
||||
parts.append(text(270, 104, 'готовых в секунду', 14, MUTED, 'middle'))
|
||||
parts.append(text(720, 104, 'RSS worker, МиБ', 14, MUTED, 'middle'))
|
||||
parts.append('</svg>\n')
|
||||
(OUT / 'track1-tradeoff.svg').write_text(''.join(parts), encoding='utf-8')
|
||||
|
||||
|
||||
def write_overload(overload):
|
||||
labels = ('202 принято', '429 отклонено')
|
||||
values = [overload['accepted'], overload['rejected_429']]
|
||||
parts = [header(960, 540, 'Backpressure: часть upload отклонена, пока worker остановлен')]
|
||||
parts.append(text(48, 42, 'Пока worker остановлен, лишняя работа не принимается', 22, INK, 'start', '500'))
|
||||
parts.append(text(
|
||||
48,
|
||||
68,
|
||||
'28 попыток. Лимит queued + processing = %s. После старта принятые дошли до ready' % overload['cap'],
|
||||
14,
|
||||
MUTED,
|
||||
))
|
||||
bars(parts, (140, 110, 680, 320), 32, ticks(32, 4), labels, values, (COLORS[1], COLORS[2]))
|
||||
cap_y = 110 + 320 - (overload['cap'] / 32) * 320
|
||||
parts.append('<line x1="140" y1="%g" x2="820" y2="%g" stroke="%s" stroke-dasharray="5 4"/>\n' % (cap_y, cap_y, MUTED))
|
||||
parts.append(text(828, cap_y + 4, 'лимит %s' % overload['cap'], 14, MUTED))
|
||||
parts.append(text(36, 270, 'ответы', 14, MUTED, 'middle', '400', -90))
|
||||
parts.append('</svg>\n')
|
||||
(OUT / 'track1-overload.svg').write_text(''.join(parts), encoding='utf-8')
|
||||
|
||||
|
||||
def main():
|
||||
data = json.loads(SOURCE.read_text(encoding='utf-8'))
|
||||
runs = data['runs']
|
||||
if [run['concurrency_prefetch'] for run in runs] != [1, 2, 4]:
|
||||
raise SystemExit('track1.json runs are not prefetch 1, 2, 4')
|
||||
write_p95(runs)
|
||||
write_tradeoff(runs)
|
||||
write_overload(data['overload'])
|
||||
for name in ('track1-p95.svg', 'track1-tradeoff.svg', 'track1-overload.svg'):
|
||||
print('wrote evidence/%s' % name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user