Diffinery

homeflare/celldpublic

celld/docs/services/workers-flow.svg
113 lines · 8.4 KBRaw History
1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 454" role="img" aria-labelledby="workersFlowTitle workersFlowDesc">
2 <title id="workersFlowTitle">Where a Worker request runs on a celld fleet</title>
3 <desc id="workersFlowDesc">An ingress terminates TLS and can send a request to any node of the fleet. The node that accepts the request runs the Worker deployment in a V8 isolate and calls fetch with the request, env, and ctx. The handler returns a Response. The env object holds the bindings, and a binding call leaves the isolate: a KV namespace, a D1 database, a queue, and a Durable Object are each a cell with one owner node, and an R2 binding reads the shared fleet bucket instead.</desc>
4 <style>
5 /* GitHub renders this file as an image, so the diagram carries literal
6 colours here. The site rules in landing/src/style.css are more specific,
7 so the documentation theme tokens win there. SVG paints text black by
8 default, and a class that sets only `color` never reaches the fill, so
9 every label sets fill="currentColor" as well. */
10 svg { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; }
11 text { font-size: 12px; fill: currentColor; }
12 .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
13 .d-ink { color: #121212; }
14 .d-soft { color: #3d3b37; }
15 .d-faint { color: #6e6a62; }
16 .d-acc { color: #10803f; }
17 .d-panel { color: #ffffff; }
18 .d-sunk { color: #f0eee8; }
19 .d-tint { color: #d6efdf; }
20 @media (prefers-color-scheme: dark) {
21 .d-ink { color: #efede7; }
22 .d-soft { color: #c9c6be; }
23 .d-faint { color: #928e85; }
24 .d-acc { color: #3fc472; }
25 .d-panel { color: #1a1a19; }
26 .d-sunk { color: #232321; }
27 .d-tint { color: #10301d; }
28 }
29 </style>
30 <defs>
31 <marker id="wf-arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="10"
32 markerHeight="10" markerUnits="userSpaceOnUse" orient="auto-start-reverse">
33 <path class="d-acc" fill="none" stroke="currentColor" stroke-width="1" d="M1 1 L5 5 L1 9" />
34 </marker>
35 <marker id="wf-arrow-acc" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="10"
36 markerHeight="10" markerUnits="userSpaceOnUse" orient="auto-start-reverse">
37 <path class="d-acc" fill="none" stroke="currentColor" stroke-width="1" d="M1 1 L5 5 L1 9" />
38 </marker>
39 </defs>
40
41 <!-- client and ingress: TLS ends outside celld -->
42 <rect class="d-panel" x="110" y="8" width="180" height="34" fill="currentColor"/>
43 <rect class="d-ink" x="110" y="8" width="180" height="34" fill="none" stroke="currentColor" stroke-width="1"/>
44 <text class="d-ink" x="200" y="29.5" fill="currentColor" text-anchor="middle">HTTP client</text>
45 <path class="d-acc" d="M200,42 V61" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
46
47 <rect class="d-panel" x="70" y="62" width="260" height="46" fill="currentColor"/>
48 <rect class="d-ink" x="70" y="62" width="260" height="46" fill="none" stroke="currentColor" stroke-width="1"/>
49 <text class="d-ink" x="200" y="82.5" fill="currentColor" text-anchor="middle">Ingress or load balancer</text>
50 <text class="d-soft" x="200" y="96.5" fill="currentColor" text-anchor="middle">terminates TLS</text>
51
52 <!-- any node of the fleet can accept the request -->
53 <path class="d-acc" d="M200 108 V120 H66 V131" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
54 <path class="d-acc" d="M200,108 V131" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
55 <path class="d-acc" d="M200 108 V120 H334 V131" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
56
57 <rect class="d-ink" x="8" y="132" width="116" height="32" fill="none" stroke="currentColor" stroke-width="1"/>
58 <text class="d-ink" x="66" y="152.5" fill="currentColor" text-anchor="middle">celld node</text>
59 <rect class="d-acc" x="142" y="132" width="116" height="32" fill="none" stroke="currentColor" stroke-width="1"/>
60 <text class="d-ink" x="200" y="152.5" fill="currentColor" text-anchor="middle">celld node</text>
61 <rect class="d-ink" x="276" y="132" width="116" height="32" fill="none" stroke="currentColor" stroke-width="1"/>
62 <text class="d-ink" x="334" y="152.5" fill="currentColor" text-anchor="middle">celld node</text>
63
64 <path class="d-acc" d="M200,164 V187" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
65 <text class="d-faint" x="208" y="180" fill="currentColor">any node</text>
66
67 <!-- the isolate of the accepting node -->
68 <rect class="d-sunk" x="20" y="188" width="360" height="124" fill="currentColor"/>
69 <rect class="d-ink" x="20" y="188" width="360" height="124" fill="none" stroke="currentColor" stroke-width="1"/>
70 <text class="d-soft" x="200" y="211" fill="currentColor" text-anchor="middle">Worker deployment in a V8 isolate</text>
71
72 <rect class="d-tint" x="60" y="220" width="280" height="32" fill="currentColor"/>
73 <rect class="d-acc" x="60" y="220" width="280" height="32" fill="none" stroke="currentColor" stroke-width="1"/>
74 <text class="d-ink mono" x="200" y="240" fill="currentColor" text-anchor="middle">fetch(request, env, ctx)</text>
75
76 <path class="d-acc" d="M150 252 V262 H110 V271" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow)"/>
77 <path class="d-acc" d="M250 252 V262 H290 V271" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow-acc)"/>
78
79 <rect class="d-panel" x="40" y="272" width="140" height="30" fill="currentColor"/>
80 <rect class="d-ink" x="40" y="272" width="140" height="30" fill="none" stroke="currentColor" stroke-width="1"/>
81 <text class="d-ink" x="110" y="291.5" fill="currentColor" text-anchor="middle">Response</text>
82
83 <rect class="d-panel" x="228" y="272" width="124" height="30" fill="currentColor"/>
84 <rect class="d-acc" x="228" y="272" width="124" height="30" fill="none" stroke="currentColor" stroke-width="1"/>
85 <text class="d-ink mono" x="290" y="291" fill="currentColor" text-anchor="middle">env</text>
86
87 <!-- a binding call leaves the isolate, and its target decides where it goes -->
88 <path class="d-acc" d="M290,302 V330" fill="none" stroke="currentColor" stroke-width="1"/>
89 <path class="d-acc" d="M142,330 H338" fill="none" stroke="currentColor" stroke-width="1"/>
90 <path class="d-acc" d="M142,330 V351" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow-acc)"/>
91 <path class="d-acc" d="M338,330 V351" fill="none" stroke="currentColor" stroke-width="1" marker-end="url(#wf-arrow-acc)"/>
92 <text class="d-faint" x="96" y="326" fill="currentColor" text-anchor="middle">to the owner</text>
93 <text class="d-faint" x="366" y="326" fill="currentColor" text-anchor="middle">direct</text>
94
95 <rect class="d-soft" x="8" y="352" width="268" height="92" fill="none" stroke="currentColor" stroke-width="1"/>
96 <text class="d-ink" x="142" y="370" fill="currentColor" text-anchor="middle">cells</text>
97 <text class="d-faint" x="142" y="384" fill="currentColor" text-anchor="middle">one owner node each</text>
98 <rect class="d-soft" x="14" y="394" width="58" height="40" fill="none" stroke="currentColor" stroke-width="1"/>
99 <text class="d-ink" x="43" y="418.5" fill="currentColor" text-anchor="middle">KV</text>
100 <rect class="d-soft" x="78" y="394" width="58" height="40" fill="none" stroke="currentColor" stroke-width="1"/>
101 <text class="d-ink" x="107" y="418.5" fill="currentColor" text-anchor="middle">D1</text>
102 <rect class="d-soft" x="142" y="394" width="58" height="40" fill="none" stroke="currentColor" stroke-width="1"/>
103 <text class="d-ink" x="171" y="418.5" fill="currentColor" text-anchor="middle">Queues</text>
104 <rect class="d-soft" x="206" y="394" width="58" height="40" fill="none" stroke="currentColor" stroke-width="1"/>
105 <text class="d-ink" x="235" y="411.5" fill="currentColor" text-anchor="middle">Durable</text>
106 <text class="d-ink" x="235" y="425.5" fill="currentColor" text-anchor="middle">Objects</text>
107
108 <rect class="d-soft" x="284" y="352" width="108" height="92" fill="none" stroke="currentColor" stroke-width="1"/>
109 <text class="d-ink" x="338" y="370" fill="currentColor" text-anchor="middle">fleet bucket</text>
110 <text class="d-faint" x="338" y="384" fill="currentColor" text-anchor="middle">no owner</text>
111 <rect class="d-soft" x="292" y="394" width="92" height="40" fill="none" stroke="currentColor" stroke-width="1"/>
112 <text class="d-ink" x="338" y="418.5" fill="currentColor" text-anchor="middle">R2</text>
113</svg>