1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 16:52:59 +01:00
actix-website/static/img/diagrams/connection_overview.svg
Maxim Vorobjov c1a8103cbc Architecture diagrams of HttpServer and Connection lifecycle (#148)
* add arch diagrams and menu

* fix colors for arch diagrams

* refine architecture diagrams, ready for review

* capitalize titles and add mmdc instruction

* apply code review requested changes

* Add links to accept, worker and dispatcher too
2020-01-28 20:36:35 +09:00

4 lines
15 KiB
XML

<svg id="mermaid-1579866914290" width="100%" xmlns="http://www.w3.org/2000/svg" height="100%" style="max-width:1090px;" viewBox="-50 -10 1090 766"><style>#mermaid-1579866914290 .label{font-family:trebuchet ms,verdana,arial;color:#333}#mermaid-1579866914290 .node circle,#mermaid-1579866914290 .node ellipse,#mermaid-1579866914290 .node polygon,#mermaid-1579866914290 .node rect{fill:#eee;stroke:#999;stroke-width:1px}#mermaid-1579866914290 .node.clickable{cursor:pointer}#mermaid-1579866914290 .arrowheadPath{fill:#333}#mermaid-1579866914290 .edgePath .path{stroke:#666;stroke-width:1.5px}#mermaid-1579866914290 .edgeLabel{background-color:#fff}#mermaid-1579866914290 .cluster rect{fill:#eaf2fb!important;stroke:#26a!important;stroke-width:1px!important}#mermaid-1579866914290 .cluster text{fill:#333}#mermaid-1579866914290 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:trebuchet ms,verdana,arial;font-size:12px;background:#eaf2fb;border:1px solid #26a;border-radius:2px;pointer-events:none;z-index:100}#mermaid-1579866914290 .actor{stroke:#999;fill:#eee}#mermaid-1579866914290 text.actor{fill:#333;stroke:none}#mermaid-1579866914290 .actor-line{stroke:#666}#mermaid-1579866914290 .messageLine0{marker-end:"url(#arrowhead)"}#mermaid-1579866914290 .messageLine0,#mermaid-1579866914290 .messageLine1{stroke-width:1.5;stroke-dasharray:"2 2";stroke:#333}#mermaid-1579866914290 #arrowhead{fill:#333}#mermaid-1579866914290 #crosshead path{fill:#333!important;stroke:#333!important}#mermaid-1579866914290 .messageText{fill:#333;stroke:none}#mermaid-1579866914290 .labelBox{stroke:#999;fill:#eee}#mermaid-1579866914290 .labelText,#mermaid-1579866914290 .loopText{fill:#fff;stroke:none}#mermaid-1579866914290 .loopLine{stroke-width:2;stroke-dasharray:"2 2";marker-end:"url(#arrowhead)";stroke:#999}#mermaid-1579866914290 .note{stroke:#770;fill:#ffa}#mermaid-1579866914290 .noteText{fill:#000;stroke:none;font-family:trebuchet ms,verdana,arial;font-size:14px}#mermaid-1579866914290 .section{stroke:none;opacity:.2}#mermaid-1579866914290 .section0,#mermaid-1579866914290 .section2{fill:#80b3e6}#mermaid-1579866914290 .section1,#mermaid-1579866914290 .section3{fill:#fff;opacity:.2}#mermaid-1579866914290 .sectionTitle0,#mermaid-1579866914290 .sectionTitle1,#mermaid-1579866914290 .sectionTitle2,#mermaid-1579866914290 .sectionTitle3{fill:#333}#mermaid-1579866914290 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px}#mermaid-1579866914290 .grid .tick{stroke:#e6e6e6;opacity:.3;shape-rendering:crispEdges}#mermaid-1579866914290 .grid path{stroke-width:0}#mermaid-1579866914290 .today{fill:none;stroke:#d42;stroke-width:2px}#mermaid-1579866914290 .task{stroke-width:2}#mermaid-1579866914290 .taskText{text-anchor:middle;font-size:11px}#mermaid-1579866914290 .taskTextOutsideRight{fill:#333;text-anchor:start;font-size:11px}#mermaid-1579866914290 .taskTextOutsideLeft{fill:#333;text-anchor:end;font-size:11px}#mermaid-1579866914290 .taskText0,#mermaid-1579866914290 .taskText1,#mermaid-1579866914290 .taskText2,#mermaid-1579866914290 .taskText3{fill:#fff}#mermaid-1579866914290 .task0,#mermaid-1579866914290 .task1,#mermaid-1579866914290 .task2,#mermaid-1579866914290 .task3{fill:#26a;stroke:#1a4d80}#mermaid-1579866914290 .taskTextOutside0,#mermaid-1579866914290 .taskTextOutside1,#mermaid-1579866914290 .taskTextOutside2,#mermaid-1579866914290 .taskTextOutside3{fill:#333}#mermaid-1579866914290 .active0,#mermaid-1579866914290 .active1,#mermaid-1579866914290 .active2,#mermaid-1579866914290 .active3{fill:#eee;stroke:#1a4d80}#mermaid-1579866914290 .activeText0,#mermaid-1579866914290 .activeText1,#mermaid-1579866914290 .activeText2,#mermaid-1579866914290 .activeText3{fill:#333!important}#mermaid-1579866914290 .done0,#mermaid-1579866914290 .done1,#mermaid-1579866914290 .done2,#mermaid-1579866914290 .done3{stroke:#666;fill:#bbb;stroke-width:2}#mermaid-1579866914290 .doneText0,#mermaid-1579866914290 .doneText1,#mermaid-1579866914290 .doneText2,#mermaid-1579866914290 .doneText3{fill:#333!important}#mermaid-1579866914290 .crit0,#mermaid-1579866914290 .crit1,#mermaid-1579866914290 .crit2,#mermaid-1579866914290 .crit3{stroke:#b1361b;fill:#d42;stroke-width:2}#mermaid-1579866914290 .activeCrit0,#mermaid-1579866914290 .activeCrit1,#mermaid-1579866914290 .activeCrit2,#mermaid-1579866914290 .activeCrit3{stroke:#b1361b;fill:#eee;stroke-width:2}#mermaid-1579866914290 .doneCrit0,#mermaid-1579866914290 .doneCrit1,#mermaid-1579866914290 .doneCrit2,#mermaid-1579866914290 .doneCrit3{stroke:#b1361b;fill:#bbb;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-1579866914290 .activeCritText0,#mermaid-1579866914290 .activeCritText1,#mermaid-1579866914290 .activeCritText2,#mermaid-1579866914290 .activeCritText3,#mermaid-1579866914290 .doneCritText0,#mermaid-1579866914290 .doneCritText1,#mermaid-1579866914290 .doneCritText2,#mermaid-1579866914290 .doneCritText3{fill:#333!important}#mermaid-1579866914290 .titleText{text-anchor:middle;font-size:18px;fill:#333}#mermaid-1579866914290 g.classGroup text{fill:#999;stroke:none;font-family:trebuchet ms,verdana,arial;font-size:10px}#mermaid-1579866914290 g.classGroup rect{fill:#eee;stroke:#999}#mermaid-1579866914290 g.classGroup line{stroke:#999;stroke-width:1}#mermaid-1579866914290 .classLabel .box{stroke:none;stroke-width:0;fill:#eee;opacity:.5}#mermaid-1579866914290 .classLabel .label{fill:#999;font-size:10px}#mermaid-1579866914290 .relation{stroke:#999;stroke-width:1;fill:none}#mermaid-1579866914290 #compositionEnd,#mermaid-1579866914290 #compositionStart{fill:#999;stroke:#999;stroke-width:1}#mermaid-1579866914290 #aggregationEnd,#mermaid-1579866914290 #aggregationStart{fill:#eee;stroke:#999;stroke-width:1}#mermaid-1579866914290 #dependencyEnd,#mermaid-1579866914290 #dependencyStart,#mermaid-1579866914290 #extensionEnd,#mermaid-1579866914290 #extensionStart{fill:#999;stroke:#999;stroke-width:1}#mermaid-1579866914290 .branch-label,#mermaid-1579866914290 .commit-id,#mermaid-1579866914290 .commit-msg{fill:#d3d3d3;color:#d3d3d3}</style><style>#mermaid-1579866914290 {
color: rgb(0, 0, 0);
font: normal normal 400 normal 16px / normal "Times New Roman";
}</style><g></g><g><line id="actor0" x1="75" y1="5" x2="75" y2="755" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="0" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="75" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="75" dy="0">ServerBuilder</tspan></text></g><g><line id="actor1" x1="275" y1="5" x2="275" y2="755" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="200" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="275" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="275" dy="0">Accept</tspan></text></g><g><line id="actor2" x1="475" y1="5" x2="475" y2="755" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="400" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="475" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="475" dy="0">WorkerClient</tspan></text></g><g><line id="actor3" x1="675" y1="5" x2="675" y2="755" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="600" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="675" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="675" dy="0">Worker</tspan></text></g><g><line id="actor4" x1="875" y1="5" x2="875" y2="755" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="800" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="875" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="875" dy="0">Dispatcher</tspan></text></g><defs><marker id="arrowhead" refX="5" refY="2" markerWidth="6" markerHeight="4" orient="auto"><path d="M 0,0 V 4 L6,2 Z"></path></marker></defs><defs><marker id="crosshead" markerWidth="15" markerHeight="8" orient="auto" refX="16" refY="4"><path fill="black" stroke="#000000" stroke-width="1px" d="M 9,2 V 6 L16,4 Z" style="stroke-dasharray: 0, 0;"></path><path fill="none" stroke="#000000" stroke-width="1px" d="M 0,1 L 6,7 M 6,1 L 0,7" style="stroke-dasharray: 0, 0;"></path></marker></defs><g><text x="175" y="93" class="messageText" style="text-anchor: middle;">start(socks, workers)</text><line x1="75" y1="100" x2="275" y2="100" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><rect x="200" y="110" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="196" y="134" fill="black" class="noteText"><tspan x="216" fill="black">accept Connections</tspan></text></g><g><rect x="270" y="173" fill="#f4f4f4" stroke="#666" width="10" height="154" rx="0" ry="0"></rect></g><g><text x="280" y="199" class="messageText" style="text-anchor: middle;">poll() --&gt; Conn</text><path d="M 280,206 C 340,196 340,236 280,226" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></path></g><g><rect x="200" y="246" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="196" y="270" fill="black" class="noteText"><tspan x="216" fill="black">backpressure logic</tspan></text></g><g><text x="377.5" y="310" class="messageText" style="text-anchor: middle;">send(Conn)</text><line x1="280" y1="317" x2="475" y2="317" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><line x1="170" y1="156" x2="485" y2="156" class="loopLine"></line><line x1="485" y1="156" x2="485" y2="327" class="loopLine"></line><line x1="170" y1="327" x2="485" y2="327" class="loopLine"></line><line x1="170" y1="156" x2="170" y2="327" class="loopLine"></line><polygon points="170,156 220,156 220,169 211.6,176 170,176" class="labelBox"></polygon><text x="177.5" y="171" fill="black" class="labelText"><tspan x="177.5" fill="black">loop</tspan></text><text x="327.5" y="171" fill="black" class="loopText" style="text-anchor: middle;"><tspan x="327.5" fill="black">[ poll connections on sockets ]</tspan></text></g><g><rect x="600" y="337" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="596" y="361" fill="black" class="noteText"><tspan x="616" fill="black">process Connections</tspan></text></g><g><rect x="670" y="400" fill="#f4f4f4" stroke="#666" width="10" height="124" rx="0" ry="0"></rect></g><g><text x="572.5" y="426" class="messageText" style="text-anchor: middle;">rx.poll_next()</text><line x1="670" y1="433" x2="475" y2="433" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><rect x="600" y="443" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="596" y="467" fill="black" class="noteText"><tspan x="616" fill="black">Service factories</tspan></text></g><g><text x="777.5" y="507" class="messageText" style="text-anchor: middle;">new(stream)</text><line x1="680" y1="514" x2="875" y2="514" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><line x1="465" y1="383" x2="885" y2="383" class="loopLine"></line><line x1="885" y1="383" x2="885" y2="524" class="loopLine"></line><line x1="465" y1="524" x2="885" y2="524" class="loopLine"></line><line x1="465" y1="383" x2="465" y2="524" class="loopLine"></line><polygon points="465,383 515,383 515,396 506.6,403 465,403" class="labelBox"></polygon><text x="472.5" y="398" fill="black" class="labelText"><tspan x="472.5" fill="black">loop</tspan></text><text x="675" y="398" fill="black" class="loopText" style="text-anchor: middle;"><tspan x="675" fill="black">[ Worker as Future::poll ]</tspan></text></g><g><rect x="800" y="534" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="796" y="558" fill="black" class="noteText"><tspan x="816" fill="black">process Requests</tspan></text></g><g><rect x="870" y="597" fill="#f4f4f4" stroke="#666" width="10" height="73" rx="0" ry="0"></rect></g><g><text x="880" y="623" class="messageText" style="text-anchor: middle;">Dispatch requests</text><path d="M 880,630 C 940,620 940,660 880,650" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></path></g><g><line x1="770" y1="580" x2="990" y2="580" class="loopLine"></line><line x1="990" y1="580" x2="990" y2="670" class="loopLine"></line><line x1="770" y1="670" x2="990" y2="670" class="loopLine"></line><line x1="770" y1="580" x2="770" y2="670" class="loopLine"></line><polygon points="770,580 820,580 820,593 811.6,600 770,600" class="labelBox"></polygon><text x="777.5" y="595" fill="black" class="labelText"><tspan x="777.5" fill="black">loop</tspan></text><text x="880" y="595" fill="black" class="loopText" style="text-anchor: middle;"><tspan x="880" fill="black">[ Dispatcher::poll ]</tspan></text></g><g><rect x="0" y="690" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="75" y="722.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="75" dy="0">ServerBuilder</tspan></text></g><g><rect x="200" y="690" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="275" y="722.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="275" dy="0">Accept</tspan></text></g><g><rect x="400" y="690" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="475" y="722.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="475" dy="0">WorkerClient</tspan></text></g><g><rect x="600" y="690" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="675" y="722.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="675" dy="0">Worker</tspan></text></g><g><rect x="800" y="690" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="875" y="722.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="875" dy="0">Dispatcher</tspan></text></g></svg>