Diffinery

homeflare/celldpublic

celld/docs/services/workers-flow.svg
111 lines · 8.5 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: 13px; 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="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
32 <path class="d-soft" d="M0,1 L9,5 L0,9 z" fill="currentColor"/>
33 </marker>
34 <marker id="wf-arrow-acc" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
35 <path class="d-acc" d="M0,1 L9,5 L0,9 z" fill="currentColor"/>
36 </marker>
37 </defs>
38
39 <!-- client and ingress: TLS ends outside celld -->
40 <rect class="d-panel" x="110" y="8" width="180" height="34" rx="6" fill="currentColor"/>
41 <rect class="d-ink" x="110" y="8" width="180" height="34" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
42 <text class="d-ink" x="200" y="30" fill="currentColor" text-anchor="middle">HTTP client</text>
43 <path class="d-soft" d="M200,42 V58" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
44
45 <rect class="d-panel" x="70" y="62" width="260" height="46" rx="6" fill="currentColor"/>
46 <rect class="d-ink" x="70" y="62" width="260" height="46" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
47 <text class="d-ink" x="200" y="84" fill="currentColor" text-anchor="middle">Ingress or load balancer</text>
48 <text class="d-soft" x="200" y="101" fill="currentColor" text-anchor="middle">terminates TLS</text>
49
50 <!-- any node of the fleet can accept the request -->
51 <path class="d-soft" d="M200,108 C200,124 66,114 66,126" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
52 <path class="d-soft" d="M200,108 V126" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
53 <path class="d-soft" d="M200,108 C200,124 334,114 334,126" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
54
55 <rect class="d-ink" x="8" y="132" width="116" height="32" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
56 <text class="d-ink" x="66" y="153" fill="currentColor" text-anchor="middle">celld node</text>
57 <rect class="d-acc" x="142" y="132" width="116" height="32" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
58 <text class="d-ink" x="200" y="153" fill="currentColor" text-anchor="middle">celld node</text>
59 <rect class="d-ink" x="276" y="132" width="116" height="32" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
60 <text class="d-ink" x="334" y="153" fill="currentColor" text-anchor="middle">celld node</text>
61
62 <path class="d-soft" d="M200,164 V184" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
63 <text class="d-faint" x="208" y="180" fill="currentColor">any node</text>
64
65 <!-- the isolate of the accepting node -->
66 <rect class="d-sunk" x="20" y="188" width="360" height="124" rx="8" fill="currentColor"/>
67 <rect class="d-ink" x="20" y="188" width="360" height="124" rx="8" fill="none" stroke="currentColor" stroke-width="1.5"/>
68 <text class="d-soft" x="200" y="211" fill="currentColor" text-anchor="middle">Worker deployment in a V8 isolate</text>
69
70 <rect class="d-tint" x="60" y="220" width="280" height="32" rx="6" fill="currentColor"/>
71 <rect class="d-acc" x="60" y="220" width="280" height="32" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
72 <text class="d-ink mono" x="200" y="241" fill="currentColor" text-anchor="middle">fetch(request, env, ctx)</text>
73
74 <path class="d-soft" d="M150,252 C150,268 110,258 110,268" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow)"/>
75 <path class="d-acc" d="M250,252 C250,268 290,258 290,268" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow-acc)"/>
76
77 <rect class="d-panel" x="40" y="272" width="140" height="30" rx="6" fill="currentColor"/>
78 <rect class="d-ink" x="40" y="272" width="140" height="30" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
79 <text class="d-ink" x="110" y="292" fill="currentColor" text-anchor="middle">Response</text>
80
81 <rect class="d-panel" x="228" y="272" width="124" height="30" rx="6" fill="currentColor"/>
82 <rect class="d-acc" x="228" y="272" width="124" height="30" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
83 <text class="d-ink mono" x="290" y="292" fill="currentColor" text-anchor="middle">env</text>
84
85 <!-- a binding call leaves the isolate, and its target decides where it goes -->
86 <path class="d-acc" d="M290,302 V330" fill="none" stroke="currentColor" stroke-width="1.5"/>
87 <path class="d-acc" d="M142,330 H338" fill="none" stroke="currentColor" stroke-width="1.5"/>
88 <path class="d-acc" d="M142,330 V348" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow-acc)"/>
89 <path class="d-acc" d="M338,330 V348" fill="none" stroke="currentColor" stroke-width="1.5" marker-end="url(#wf-arrow-acc)"/>
90 <text class="d-faint" x="96" y="326" fill="currentColor" text-anchor="middle">to the owner</text>
91 <text class="d-faint" x="366" y="326" fill="currentColor" text-anchor="middle">direct</text>
92
93 <rect class="d-soft" x="8" y="352" width="268" height="92" rx="8" fill="none" stroke="currentColor" stroke-width="1.5"/>
94 <text class="d-ink" x="142" y="370" fill="currentColor" text-anchor="middle">cells</text>
95 <text class="d-faint" x="142" y="386" fill="currentColor" text-anchor="middle">one owner node each</text>
96 <rect class="d-soft" x="14" y="394" width="58" height="40" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
97 <text class="d-ink" x="43" y="419" fill="currentColor" text-anchor="middle">KV</text>
98 <rect class="d-soft" x="78" y="394" width="58" height="40" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
99 <text class="d-ink" x="107" y="419" fill="currentColor" text-anchor="middle">D1</text>
100 <rect class="d-soft" x="142" y="394" width="58" height="40" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
101 <text class="d-ink" x="171" y="419" fill="currentColor" text-anchor="middle">Queues</text>
102 <rect class="d-soft" x="206" y="394" width="58" height="40" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
103 <text class="d-ink" x="235" y="412" fill="currentColor" text-anchor="middle">Durable</text>
104 <text class="d-ink" x="235" y="427" fill="currentColor" text-anchor="middle">Objects</text>
105
106 <rect class="d-soft" x="284" y="352" width="108" height="92" rx="8" fill="none" stroke="currentColor" stroke-width="1.5"/>
107 <text class="d-ink" x="338" y="370" fill="currentColor" text-anchor="middle">fleet bucket</text>
108 <text class="d-faint" x="338" y="386" fill="currentColor" text-anchor="middle">no owner</text>
109 <rect class="d-soft" x="292" y="394" width="92" height="40" rx="6" fill="none" stroke="currentColor" stroke-width="1.5"/>
110 <text class="d-ink" x="338" y="419" fill="currentColor" text-anchor="middle">R2</text>
111</svg>