Files
lambda_local_runner/docs/lambdas-md/lambda-lifecycle.svg
2026-05-11 20:13:11 -03:00

160 lines
11 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 14.1.2 (0)
-->
<!-- Title: lifecycle Pages: 1 -->
<svg width="1215pt" height="546pt"
viewBox="0.00 0.00 1215.00 546.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 541.5)">
<title>lifecycle</title>
<polygon fill="#0a0e17" stroke="none" points="-4,4 -4,-541.5 1211.25,-541.5 1211.25,4 -4,4"/>
<text xml:space="preserve" text-anchor="middle" x="603.62" y="-518.3" font-family="Helvetica,sans-Serif" font-size="16.00" fill="#0066ff">Lambda execution environment lifecycle</text>
<g id="clust1" class="cluster">
<title>cluster_cold</title>
<polygon fill="#0a0e17" stroke="#ff3d00" stroke-dasharray="5,2" points="8,-202.25 8,-502 518,-502 518,-202.25 8,-202.25"/>
<text xml:space="preserve" text-anchor="middle" x="263" y="-482.8" font-family="Helvetica,sans-Serif" font-size="16.00" fill="#ff3d00">Cold start (first invocation on a fresh execution environment)</text>
</g>
<g id="clust2" class="cluster">
<title>cluster_invoke</title>
<polygon fill="#0a0e17" stroke="#1e2a4a" stroke-dasharray="5,2" points="855,-8 855,-173 1019,-173 1019,-8 855,-8"/>
<text xml:space="preserve" text-anchor="middle" x="937" y="-153.8" font-family="Helvetica,sans-Serif" font-size="16.00" fill="#8892a8">Invocation</text>
</g>
<g id="clust3" class="cluster">
<title>cluster_warm</title>
<polygon fill="#0a0e17" stroke="#00c853" stroke-dasharray="5,2" points="526,-215.75 526,-307.75 1061,-307.75 1061,-215.75 526,-215.75"/>
<text xml:space="preserve" text-anchor="middle" x="793.5" y="-288.55" font-family="Helvetica,sans-Serif" font-size="16.00" fill="#00c853">Warm reuse (subsequent invocations on the same environment)</text>
</g>
<!-- download -->
<g id="node1" class="node">
<title>download</title>
<polygon fill="#243056" stroke="#1e2a4a" points="503.12,-466.5 370.88,-466.5 370.88,-430.5 503.12,-430.5 503.12,-466.5"/>
<text xml:space="preserve" text-anchor="middle" x="437" y="-451.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">1. Download code</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-438.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">zip / container layers</text>
</g>
<!-- bootstrap -->
<g id="node2" class="node">
<title>bootstrap</title>
<polygon fill="#243056" stroke="#1e2a4a" points="505.75,-387.25 368.25,-387.25 368.25,-351.25 505.75,-351.25 505.75,-387.25"/>
<text xml:space="preserve" text-anchor="middle" x="437" y="-372.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">2. Start runtime</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-358.8" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">bootstrap (python3.x)</text>
</g>
<!-- download&#45;&gt;bootstrap -->
<g id="edge1" class="edge">
<title>download&#45;&gt;bootstrap</title>
<path fill="none" stroke="#4a5568" d="M437,-430.36C437,-421.12 437,-409.48 437,-398.91"/>
<polygon fill="#4a5568" stroke="#4a5568" points="440.5,-399.13 437,-389.13 433.5,-399.13 440.5,-399.13"/>
</g>
<!-- init -->
<g id="node3" class="node">
<title>init</title>
<polygon fill="#1a1a3a" stroke="#1e2a4a" points="510.25,-285.75 363.75,-285.75 363.75,-210.25 510.25,-210.25 510.25,-285.75"/>
<text xml:space="preserve" text-anchor="middle" x="437" y="-271.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ffc107">3. Init phase</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-257.8" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ffc107">run module&#45;level code</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-244.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ffc107">import boto3 / aioboto3</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-230.8" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ffc107">build clients</text>
<text xml:space="preserve" text-anchor="middle" x="437" y="-217.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ffc107">(billed; capped at 10 s)</text>
</g>
<!-- bootstrap&#45;&gt;init -->
<g id="edge2" class="edge">
<title>bootstrap&#45;&gt;init</title>
<path fill="none" stroke="#4a5568" d="M437,-350.91C437,-336.89 437,-316.46 437,-297.56"/>
<polygon fill="#4a5568" stroke="#4a5568" points="440.5,-297.57 437,-287.57 433.5,-297.57 440.5,-297.57"/>
</g>
<!-- handler -->
<g id="node4" class="node">
<title>handler</title>
<polygon fill="#0d1a33" stroke="#1e2a4a" points="1010.62,-137.5 863.38,-137.5 863.38,-89 1010.62,-89 1010.62,-137.5"/>
<text xml:space="preserve" text-anchor="middle" x="937" y="-123.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">handler(event, context)</text>
<text xml:space="preserve" text-anchor="middle" x="937" y="-109.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">your code runs</text>
<text xml:space="preserve" text-anchor="middle" x="937" y="-96.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">(billed)</text>
</g>
<!-- init&#45;&gt;handler -->
<g id="edge3" class="edge">
<title>init&#45;&gt;handler</title>
<path fill="none" stroke="#0066ff" d="M503.5,-209.81C509.66,-207.04 515.88,-204.46 522,-202.25 632.54,-162.3 766.53,-137.96 851.78,-125.3"/>
<polygon fill="#0066ff" stroke="#0066ff" points="852.08,-128.79 861.47,-123.88 851.06,-121.86 852.08,-128.79"/>
<text xml:space="preserve" text-anchor="middle" x="605.96" y="-183.7" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8892a8">event arrives</text>
</g>
<!-- respond -->
<g id="node5" class="node">
<title>respond</title>
<polygon fill="#121829" stroke="#1e2a4a" points="996,-52 908,-52 908,-16 996,-16 996,-52"/>
<text xml:space="preserve" text-anchor="middle" x="952" y="-30.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">return / raise</text>
</g>
<!-- handler&#45;&gt;respond -->
<g id="edge4" class="edge">
<title>handler&#45;&gt;respond</title>
<path fill="none" stroke="#4a5568" d="M941.58,-88.65C943.13,-80.69 944.87,-71.72 946.48,-63.42"/>
<polygon fill="#4a5568" stroke="#4a5568" points="949.88,-64.29 948.35,-53.81 943.01,-62.96 949.88,-64.29"/>
</g>
<!-- freeze -->
<g id="node8" class="node">
<title>freeze</title>
<polygon fill="#121829" stroke="#1e2a4a" points="1193.88,-393.5 1054.12,-393.5 1054.12,-345 1193.88,-345 1193.88,-393.5"/>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-379.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">freeze</text>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-365.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">process paused</text>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-352.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">(after handler returns)</text>
</g>
<!-- respond&#45;&gt;freeze -->
<g id="edge5" class="edge">
<title>respond&#45;&gt;freeze</title>
<path fill="none" stroke="#4a5568" d="M996.29,-51.39C1052.72,-74.98 1147.76,-124.41 1188,-202.25 1221.33,-266.72 1205.08,-295.28 1184,-327 1181.66,-330.52 1178.9,-333.83 1175.88,-336.92"/>
<polygon fill="#4a5568" stroke="#4a5568" points="1173.59,-334.27 1168.5,-343.56 1178.27,-339.48 1173.59,-334.27"/>
</g>
<!-- thaw -->
<g id="node6" class="node">
<title>thaw</title>
<polygon fill="#1a3a1a" stroke="#1e2a4a" points="1050.38,-266 949.62,-266 949.62,-230 1050.38,-230 1050.38,-266"/>
<text xml:space="preserve" text-anchor="middle" x="1000" y="-251.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">thaw</text>
<text xml:space="preserve" text-anchor="middle" x="1000" y="-237.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#e8eaf0">(microseconds)</text>
</g>
<!-- thaw&#45;&gt;handler -->
<g id="edge7" class="edge">
<title>thaw&#45;&gt;handler</title>
<path fill="none" stroke="#00c853" d="M991.76,-229.65C981.97,-209.01 965.41,-174.11 953.05,-148.08"/>
<polygon fill="#00c853" stroke="#00c853" points="956.31,-146.78 948.86,-139.25 949.99,-149.78 956.31,-146.78"/>
<text xml:space="preserve" text-anchor="middle" x="994.4" y="-183.7" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8892a8">reuse env</text>
</g>
<!-- reuse -->
<g id="node7" class="node">
<title>reuse</title>
<polygon fill="#1a3a1a" stroke="#1e2a4a" points="925.62,-272.25 814.38,-272.25 814.38,-223.75 931.62,-223.75 931.62,-266.25 925.62,-272.25"/>
<polyline fill="none" stroke="#1e2a4a" points="925.62,-272.25 925.62,-266.25"/>
<polyline fill="none" stroke="#1e2a4a" points="931.62,-266.25 925.62,-266.25"/>
<text xml:space="preserve" text-anchor="middle" x="873" y="-257.8" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#00c853">globals retained:</text>
<text xml:space="preserve" text-anchor="middle" x="873" y="-244.3" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#00c853">clients, /tmp,</text>
<text xml:space="preserve" text-anchor="middle" x="873" y="-230.8" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#00c853">in&#45;memory caches</text>
</g>
<!-- reuse&#45;&gt;handler -->
<g id="edge8" class="edge">
<title>reuse&#45;&gt;handler</title>
<path fill="none" stroke="#00c853" stroke-dasharray="1,5" d="M884.44,-223.27C894.54,-202.31 909.39,-171.53 920.72,-148.01"/>
<polygon fill="#00c853" stroke="#00c853" points="923.81,-149.67 925,-139.14 917.5,-146.63 923.81,-149.67"/>
</g>
<!-- freeze&#45;&gt;thaw -->
<g id="edge6" class="edge">
<title>freeze&#45;&gt;thaw</title>
<path fill="none" stroke="#00c853" d="M1092.05,-344.65C1085.01,-339.08 1077.73,-333 1071.25,-327 1053.59,-310.64 1035.31,-290.56 1021.69,-274.86"/>
<polygon fill="#00c853" stroke="#00c853" points="1024.4,-272.65 1015.23,-267.34 1019.09,-277.21 1024.4,-272.65"/>
<text xml:space="preserve" text-anchor="middle" x="1095.62" y="-318.45" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8892a8">next event</text>
</g>
<!-- shutdown -->
<g id="node9" class="node">
<title>shutdown</title>
<polygon fill="#121829" stroke="#1e2a4a" points="1179.25,-279 1068.75,-279 1068.75,-217 1179.25,-217 1179.25,-279"/>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-264.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ff3d00">shutdown</text>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-251.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ff3d00">idle ~515 min →</text>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-237.55" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ff3d00">env torn down</text>
<text xml:space="preserve" text-anchor="middle" x="1124" y="-224.05" font-family="Helvetica,sans-Serif" font-size="11.00" fill="#ff3d00">/tmp gone</text>
</g>
<!-- freeze&#45;&gt;shutdown -->
<g id="edge9" class="edge">
<title>freeze&#45;&gt;shutdown</title>
<path fill="none" stroke="#ff3d00" stroke-dasharray="5,2" d="M1124,-344.69C1124,-329.32 1124,-308.83 1124,-290.76"/>
<polygon fill="#ff3d00" stroke="#ff3d00" points="1127.5,-290.82 1124,-280.82 1120.5,-290.82 1127.5,-290.82"/>
<text xml:space="preserve" text-anchor="middle" x="1151.75" y="-318.45" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8892a8">idle too long</text>
</g>
</g>
</svg>