<mxfile host="thecodeclouds.com" agent="hand-built" version="24.0.0" type="device">
<diagram id="ecom-peak" name="Black Friday: where 180,000 requests per second go"><mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1500" pageHeight="750" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="c1" value="Black Friday, 00:00 to 00:15: where 180,000 requests per second go" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=18;fontColor=#232F3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="14" width="1200" height="24" as="geometry"/></mxCell>
<mxCell id="c2" value="Each layer exists to make the next one smaller. Numbers are the worked example from the article." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="40" width="1200" height="18" as="geometry"/></mxCell>
<mxCell id="c3" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="90" width="215" height="380" as="geometry"/></mxCell>
<mxCell id="c4" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="40" y="94" as="sourcePoint"/><mxPoint x="40" y="466" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c5" value="Shoppers" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#5F6368;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="104" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c6" value="2.4 M sessions in the&lt;br&gt;first hour, 600 k live" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="130" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c7" value="180 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="436" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c8" value="baseline at 23:58 was&lt;br&gt;9 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c9" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=3;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="257" y="280" as="sourcePoint"/><mxPoint x="283" y="280" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c10" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="285" y="110.9" width="215" height="338.2" as="geometry"/></mxCell>
<mxCell id="c11" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="285" y="114.9" as="sourcePoint"/><mxPoint x="285" y="445.1" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c12" value="CDN + edge cache" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="299" y="124.9" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c13" value="92 % of requests end here:&lt;br&gt;images, JS, product pages" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="299" y="150.9" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c14" value="14.4 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="299" y="415.1" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c15" value="absorbs 165 k req/s&lt;br&gt;at 0 origin cost" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="299" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c16" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=3;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="502" y="280" as="sourcePoint"/><mxPoint x="528" y="280" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c17" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="530" y="131.8" width="215" height="296.4" as="geometry"/></mxCell>
<mxCell id="c18" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="530" y="135.8" as="sourcePoint"/><mxPoint x="530" y="424.2" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c19" value="Waiting room" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="544" y="145.8" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c20" value="admits 9,000 new&lt;br&gt;sessions per minute" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="544" y="171.8" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c21" value="11 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="544" y="394.2" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c22" value="peak queue 140 k people&lt;br&gt;longest wait 4 min" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="544" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c23" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=3;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="747" y="280" as="sourcePoint"/><mxPoint x="773" y="280" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c24" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#E37400;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="775" y="152.7" width="215" height="254.6" as="geometry"/></mxCell>
<mxCell id="c25" style="edgeStyle=none;html=1;rounded=0;strokeColor=#E37400;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="775" y="156.7" as="sourcePoint"/><mxPoint x="775" y="403.3" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c26" value="API gateway" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#E37400;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="789" y="166.7" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c27" value="rate limit 20 req/s&lt;br&gt;per session, bots blocked" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="789" y="192.7" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c28" value="10.2 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="789" y="373.3" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c29" value="rejects ~800 req/s&lt;br&gt;with 429" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#E37400;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="789" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c30" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=3;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="992" y="280" as="sourcePoint"/><mxPoint x="1018" y="280" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c31" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1020" y="173.6" width="215" height="212.8" as="geometry"/></mxCell>
<mxCell id="c32" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1020" y="177.6" as="sourcePoint"/><mxPoint x="1020" y="382.4" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c33" value="Browse services" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1034" y="187.6" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c34" value="catalog, search, price&lt;br&gt;85 % hit app cache" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1034" y="213.6" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c35" value="1.4 k q/s to DBs" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1034" y="352.4" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c36" value="cache absorbs&lt;br&gt;7.7 k req/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#1A73E8;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1034" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c37" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=3;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1237" y="280" as="sourcePoint"/><mxPoint x="1263" y="280" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c38" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1265" y="194.5" width="215" height="171" as="geometry"/></mxCell>
<mxCell id="c39" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=5;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1265" y="198.5" as="sourcePoint"/><mxPoint x="1265" y="361.5" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c40" value="Buy path" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;fontColor=#1E8E3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1279" y="208.5" width="195" height="20" as="geometry"/></mxCell>
<mxCell id="c41" value="cart 1,100 writes/s&lt;br&gt;checkout 55 orders/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1279" y="234.5" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c42" value="55 payments/s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=16;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1279" y="331.5" width="195" height="22" as="geometry"/></mxCell>
<mxCell id="c43" value="198 k orders&lt;br&gt;in the first hour" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1279" y="266" width="195" height="32" as="geometry"/></mxCell>
<mxCell id="c44" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#F1F6FE;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="500" width="700" height="230" as="geometry"/></mxCell>
<mxCell id="c45" value="Capacity plan for the night" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="510" width="660" height="19" as="geometry"/></mxCell>
<mxCell id="c46" value="T-30 days" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="540" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c47" value="load test at 1.5x forecast (270 k req/s at the edge)" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="540" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c48" value="T-7 days" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="570" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c49" value="change freeze on the buy path, kill switches tested" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="570" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c50" value="T-2 h" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="600" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c51" value="pre-scale: checkout 12 → 60 pods, DB read replicas 2 → 6" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="600" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c52" value="T-15 min" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="630" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c53" value="waiting room on, recommendations on cached fallback" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="630" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c54" value="T+0" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="660" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c55" value="watch orders/min and payment success rate, not CPU" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="660" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c56" value="T+3 h" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#1A73E8;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="56" y="690" width="90" height="18" as="geometry"/></mxCell>
<mxCell id="c57" value="scale down in 25 % steps; room off after 10 min of empty queue" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="150" y="690" width="580" height="18" as="geometry"/></mxCell>
<mxCell id="c58" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#E37400;fillColor=#FEF7E0;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="760" y="500" width="700" height="230" as="geometry"/></mxCell>
<mxCell id="c59" value="Why not just autoscale?" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#E37400;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="776" y="510" width="660" height="19" as="geometry"/></mxCell>
<mxCell id="c60" value="Traffic went from 9 k to 180 k req/s in 90 seconds.&lt;br&gt;A new pod takes ~45 s to be ready, a new node ~3 min,&lt;br&gt;a new database read replica 10 to 20 min.&lt;br&gt;Autoscaling reacts to load you already have. For a peak you know&lt;br&gt;is coming, scale before it and let autoscaling handle only the&lt;br&gt;surprise on top. The waiting room covers the rest:&lt;br&gt;a 4 minute queue beats a 40 minute outage." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="776" y="540" width="680" height="114" as="geometry"/></mxCell></root></mxGraphModel></diagram>
</mxfile>
