Add week 11 materials

This commit is contained in:
osukhoroslov committed 2026-11-28 00:56:20 +03:00
1 parent a499e38e6e
commit bc3e17008b
26 files changed
+1706

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

@@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="194" viewBox="0 0 1024 194" role="img" aria-labelledby="title desc">
<title id="title">Чтение с изолированной реплики etcd</title>
<desc id="desc">Два связанных узла подтвердили запись C. У отделённой ведомой осталось B. Клиент отправляет оба GET на локальный адрес именно этой ведомой.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="#245795"/></marker>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.title { font-size: 23px; font-weight: 700; }
.label { font-size: 20px; }
.code { font: 19px 'DejaVu Sans Mono', Menlo, monospace; }
.node { fill: #eaf2fc; stroke: #82a4ce; stroke-width: 1.5; }
.store { fill: #f6f9fd; stroke: #a4b9d2; stroke-width: 1.5; }
.edge { stroke: #245795; stroke-width: 2.5; fill: none; marker-end: url(#arrow); }
</style>
<rect width="1024" height="194" fill="#fff"/>
<rect class="store" x="14" y="9" width="584" height="173" rx="10"/>
<text class="title" x="306" y="44">Большинство подтвердило запись C</text>
<rect class="node" x="35" y="70" width="231" height="85" rx="9"/>
<text class="title" x="150" y="107">Лидер</text>
<text class="label" x="150" y="136">C в журнале</text>
<rect class="node" x="346" y="70" width="231" height="85" rx="9"/>
<text class="title" x="461" y="107">Ведомая реплика</text>
<text class="label" x="461" y="136">C в журнале</text>
<path d="M266 112 H346" fill="none" stroke="#245795" stroke-width="2.5"/>
<path d="M625 12 V181" fill="none" stroke="#385983" stroke-width="2.5" stroke-dasharray="7 6"/>
<rect class="store" x="652" y="9" width="358" height="173" rx="10"/>
<text class="title" x="831" y="44">Изолированная реплика</text>
<rect class="node" x="689" y="58" width="284" height="51" rx="7"/>
<text class="label" x="831" y="90">Хранит B</text>
<path class="edge" d="M831 138 V114"/>
<text class="label" x="831" y="165">Оба GET на localhost</text>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,43 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="300" viewBox="0 0 1024 300" role="img" aria-labelledby="title desc">
<title id="title">Координатор отключился после двух голосов yes</title>
<desc id="desc">Координатор получил yes от шарда Ани и от шарда магазина, затем отключился. Шард магазина не получил решения и не знает, успел ли координатор его записать.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">
<path d="M0 0 L10 5 L0 10 Z" fill="#245795"/>
</marker>
<g id="replicas" fill="#eaf2fc" stroke="#52749f" stroke-width="1.5">
<rect width="18" height="21" rx="3"/><rect x="23" width="18" height="21" rx="3"/><rect x="46" width="18" height="21" rx="3"/>
<path d="M4 8h10 M4 13h7 M27 8h10 M27 13h7 M50 8h10 M50 13h7"/>
</g>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.heading { font-size: 24px; font-weight: 700; }
.body { font-size: 20px; }
.message { font: 20px Menlo, Consolas, monospace; }
.shard { fill: #f6f9fd; stroke: #82a4ce; stroke-width: 1.5; }
.edge { fill: none; stroke: #245795; stroke-width: 2.5; marker-end: url(#arrow); }
</style>
<rect width="1024" height="300" fill="#fff"/>
<rect x="339" y="12" width="346" height="75" rx="9" fill="#fff4f1" stroke="#bb6558" stroke-width="1.5"/>
<path d="M356 29l13 13 M369 29l-13 13" fill="none" stroke="#a43d30" stroke-width="3.5" stroke-linecap="round"/>
<text x="525" y="44" font-size="22" font-weight="700">Координатор отключился</text>
<text class="body" x="512" y="71">Успел записать решение?</text>
<path class="edge" d="M247 158 V54 H335"/>
<path class="edge" d="M777 158 V54 H689"/>
<text class="message" x="290" y="43">yes</text>
<text class="message" x="734" y="43">yes</text>
<rect class="shard" x="24" y="158" width="446" height="128" rx="9"/>
<rect class="shard" x="554" y="158" width="446" height="128" rx="9"/>
<text class="heading" x="247" y="191">Шард Ани</text>
<text class="body" x="247" y="222">Подтвердил готовность к списанию</text>
<text class="heading" x="777" y="191">Шард магазина</text>
<text class="body" x="777" y="222" font-weight="bold">Решение о зачислении не получено</text>
<path d="M25 239 H469 M555 239 H999" stroke="#adc2db" stroke-width="1.5"/>
<use xlink:href="#replicas" x="100" y="252"/>
<text class="body" x="284" y="269">Группа Raft · 3 реплики</text>
<use xlink:href="#replicas" x="630" y="252"/>
<text class="body" x="814" y="269">Группа Raft · 3 реплики</text>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -0,0 +1,41 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="320" viewBox="0 0 1024 320" role="img" aria-labelledby="title desc">
<title id="title">Шарды читают решение координатора из ZooKeeper</title>
<desc id="desc">Получив оба голоса yes, координатор записал commit в ZooKeeper по пути /pay-42/decision и отключился. Шард Ани и шард магазина могут каждый самостоятельно прочитать эту запись, чтобы узнать исход перевода.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">
<path d="M0 0 L10 5 L0 10 Z" fill="#245795"/>
</marker>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.heading { font-size: 24px; font-weight: 700; }
.body { font-size: 20px; }
.value { font: 20px Menlo, Consolas, monospace; }
.shard { fill: #f6f9fd; stroke: #82a4ce; stroke-width: 1.5; }
.edge { fill: none; stroke: #245795; stroke-width: 2.5; marker-end: url(#arrow); }
</style>
<rect width="1024" height="320" fill="#fff"/>
<rect x="339" y="12" width="346" height="52" rx="9" fill="#fff4f1" stroke="#bb6558" stroke-width="1.5"/>
<path d="M356 32l13 13 M369 32l-13 13" fill="none" stroke="#a43d30" stroke-width="3.5" stroke-linecap="round"/>
<text x="525" y="46" font-size="22" font-weight="700">Координатор отключился</text>
<path class="edge" d="M512 65 V119"/>
<text class="body" x="664" y="98">До отключения записал commit</text>
<rect x="319" y="122" width="386" height="80" rx="9" fill="#eaf2fc" stroke="#5280b6" stroke-width="2"/>
<text class="heading" x="512" y="154">ZooKeeper</text>
<text class="value" x="512" y="185">/pay-42/decision = <tspan font-weight="bold">commit</tspan></text>
<path class="edge" d="M247 239 V164 H315"/>
<path class="edge" d="M777 239 V164 H709"/>
<text class="body" x="150" y="205">Читает решение</text>
<text class="body" x="874" y="205">Читает решение</text>
<rect class="shard" x="24" y="239" width="446" height="70" rx="9"/>
<rect class="shard" x="554" y="239" width="446" height="70" rx="9"/>
<text class="heading" x="247" y="269">Шард Ани</text>
<text class="body" x="247" y="295">Списание 20 000 ₽</text>
<text class="heading" x="777" y="269">Шард магазина</text>
<text class="body" x="777" y="295">Зачисление 20 000 ₽</text>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1,46 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="300" viewBox="0 0 1024 300" role="img" aria-labelledby="title desc">
<title id="title">Подготовка перевода между двумя шардами</title>
<desc id="desc">Координатор отправил prepare шарду Ани и шарду магазина. У каждого шарда своя группа Raft из трёх реплик. Шард Ани подтвердил готовность к списанию ответом yes. Ответ магазина ещё не получен.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">
<path d="M0 0 L10 5 L0 10 Z" fill="#245795"/>
</marker>
<g id="replicas" fill="#eaf2fc" stroke="#52749f" stroke-width="1.5">
<rect width="18" height="21" rx="3"/><rect x="23" width="18" height="21" rx="3"/><rect x="46" width="18" height="21" rx="3"/>
<path d="M4 8h10 M4 13h7 M27 8h10 M27 13h7 M50 8h10 M50 13h7"/>
</g>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.heading { font-size: 24px; font-weight: 700; }
.body { font-size: 20px; }
.message { font: 20px Menlo, Consolas, monospace; }
.shard { fill: #f6f9fd; stroke: #82a4ce; stroke-width: 1.5; }
.edge { fill: none; stroke: #245795; stroke-width: 2.5; marker-end: url(#arrow); }
</style>
<rect width="1024" height="300" fill="#fff"/>
<rect x="339" y="12" width="346" height="75" rx="9" fill="#eaf2fc" stroke="#82a4ce" stroke-width="1.5"/>
<text class="heading" x="512" y="44">Координатор 2PC</text>
<text class="body" x="512" y="71">Перевод 20 000 ₽</text>
<rect class="shard" x="24" y="158" width="446" height="128" rx="9"/>
<rect class="shard" x="554" y="158" width="446" height="128" rx="9"/>
<path class="edge" d="M339 51 H169 V155"/>
<path class="edge" d="M685 51 H855 V155"/>
<text class="message" x="248" y="39">prepare</text>
<text class="message" x="776" y="39">prepare</text>
<path class="edge" d="M367 158 V118 H439 V90"/>
<text class="message" x="400" y="109">yes</text>
<text class="body" x="682" y="132">Ответа пока нет</text>
<text class="heading" x="247" y="191">Шард Ани</text>
<text class="body" x="247" y="222">Списать 20 000 ₽</text>
<text class="heading" x="777" y="191">Шард магазина</text>
<text class="body" x="777" y="222">Зачислить 20 000 ₽</text>
<path d="M25 239 H469 M555 239 H999" stroke="#adc2db" stroke-width="1.5"/>
<use xlink:href="#replicas" x="100" y="252"/>
<text class="body" x="284" y="269">Группа Raft · 3 реплики</text>
<use xlink:href="#replicas" x="630" y="252"/>
<text class="body" x="814" y="269">Группа Raft · 3 реплики</text>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@@ -0,0 +1,32 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="192" viewBox="0 0 1024 192" role="img" aria-labelledby="title desc">
<title id="title">Как сервис заказов находит активный планировщик</title>
<desc id="desc">Активный экземпляр планировщика публикует свой IP-адрес B в etcd. Сервис заказов читает этот IP-адрес и отправляет запрос на доставку напрямую планировщику.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="#245795"/></marker>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.title { font-size: 23px; font-weight: 700; }
.label { font-size: 20px; }
.code { font: 19px 'DejaVu Sans Mono', Menlo, monospace; }
.node { fill: #eaf2fc; stroke: #82a4ce; stroke-width: 1.5; }
.store { fill: #f6f9fd; stroke: #a4b9d2; stroke-width: 1.5; }
.edge { stroke: #245795; stroke-width: 2.5; fill: none; marker-end: url(#arrow); }
</style>
<rect width="1024" height="192" fill="#fff"/>
<rect class="node" x="14" y="29" width="233" height="76" rx="9"/>
<text class="title" x="130" y="75">Сервис заказов</text>
<rect class="store" x="357" y="29" width="310" height="76" rx="9"/>
<text class="title" x="512" y="59">etcd</text>
<text class="code" x="512" y="88">/scheduler/leader = B</text>
<rect class="node" x="777" y="29" width="233" height="76" rx="9"/>
<text class="title" x="894" y="62">Планировщик</text>
<text class="label" x="894" y="89">IP-адрес B</text>
<path class="edge" d="M247 70 H351"/>
<text class="code" x="301" y="59">GET</text>
<path class="edge" d="M777 70 H673"/>
<text class="code" x="723" y="59">PUT</text>
<path class="edge" d="M130 105 V151 H894 V111"/>
<rect x="405" y="133" width="214" height="32" fill="#fff"/>
<text class="label" x="512" y="157">Запрос на доставку</text>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,35 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="218" viewBox="0 0 1024 218" role="img" aria-labelledby="title desc">
<title id="title">Регистрация исполнителя в ZooKeeper</title>
<desc id="desc">Исполнитель из первой сессии создаёт временный узел /member-a со значением online. Планировщик из второй сессии наблюдает за списком детей корня /. Показан фрагмент дерева перед закрытием первой сессии.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="#245795"/></marker>
</defs>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #193456; text-anchor: middle; }
.title { font-size: 23px; font-weight: 700; }
.label { font-size: 20px; }
.code { font: 19px 'DejaVu Sans Mono', Menlo, monospace; }
.node { fill: #eaf2fc; stroke: #82a4ce; stroke-width: 1.5; }
.store { fill: #f6f9fd; stroke: #a4b9d2; stroke-width: 1.5; }
.edge { stroke: #245795; stroke-width: 2.5; fill: none; marker-end: url(#arrow); }
</style>
<rect width="1024" height="218" fill="#fff"/>
<rect class="store" x="365" y="10" width="294" height="197" rx="10"/>
<text class="title" x="512" y="42">Дерево ZooKeeper</text>
<rect fill="#fff" stroke="#a4b9d2" x="470" y="57" width="84" height="42" rx="6"/>
<text class="code" x="512" y="84">/</text>
<path d="M512 99 V136" fill="none" stroke="#245795" stroke-width="2.5"/>
<rect class="node" x="389" y="136" width="246" height="51" rx="6"/>
<text class="code" x="512" y="168">member-a = online</text>
<rect class="node" x="14" y="122" width="223" height="78" rx="9"/>
<text class="title" x="125" y="154">Исполнитель</text>
<text class="label" x="125" y="182">сессия 1</text>
<path class="edge" d="M237 162 H384"/>
<text class="code" x="307" y="149">create -e</text>
<rect class="node" x="787" y="38" width="223" height="78" rx="9"/>
<text class="title" x="898" y="71">Планировщик</text>
<text class="label" x="898" y="99">сессия 2</text>
<path class="edge" d="M787 78 H559"/>
<rect x="669" y="44" width="99" height="27" fill="#fff"/>
<text class="code" x="719" y="65">ls -w /</text>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB