<mxfile host="thecodeclouds.com" agent="hand-built" version="24.0.0" type="device">
<diagram id="ecom-failures" name="Three production failures and the design that survives them"><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="780" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="c1" value="Three production failures, and the design that survives each one" 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="Top: what happened. Bottom: what the platform does instead. All three are covered in the article with numbers." 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=#D93025;fillColor=#D93025;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="76" width="460" height="50" as="geometry"/></mxCell>
<mxCell id="c4" value="A  Payment provider slows down" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=15;fontColor=#FFFFFF;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="90" width="440" height="21" as="geometry"/></mxCell>
<mxCell id="c5" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FDF3F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="140" width="460" height="170" as="geometry"/></mxCell>
<mxCell id="c6" value="What happened" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="152" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c7" value="PSP p99 goes from 400 ms to 12 s.&lt;br&gt;Client timeout is the library default, 60 s.&lt;br&gt;55 orders/s x 12 s = 660 calls in flight.&lt;br&gt;60 pods x 10 pooled PSP connections = 600.&lt;br&gt;Requests queue for the pool, health checks&lt;br&gt;time out, pods restart. Cart shares the&lt;br&gt;pool, so the whole buy path goes down." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="182" width="436" height="114" as="geometry"/></mxCell>
<mxCell id="c8" 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="270" y="314" as="sourcePoint"/><mxPoint x="270" y="340" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c9" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#F0F9F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="346" width="460" height="410" as="geometry"/></mxCell>
<mxCell id="c10" value="Design that holds" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#1E8E3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="358" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c11" value="Timeout 3 s, one retry with the same key.&lt;br&gt;Circuit breaker opens at 20 % failures&lt;br&gt;   over 30 s, routes new auths to PSP B.&lt;br&gt;Separate pool (bulkhead) per dependency.&lt;br&gt;Unknown result → PAYMENT_UNKNOWN,&lt;br&gt;   reconciler settles it in 60 s.&lt;br&gt;Result: 2 % of orders delayed, 0 lost." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="388" width="436" height="114" as="geometry"/></mxCell>
<mxCell id="c12" 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="54" y="590" width="100" height="40" as="geometry"/></mxCell>
<mxCell id="c13" value="Checkout" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="54" y="602" width="100" height="17" as="geometry"/></mxCell>
<mxCell id="c14" 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="204" y="582" width="110" height="56" as="geometry"/></mxCell>
<mxCell id="c15" value="Breaker&lt;br&gt;closed / open" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="204" y="602" width="110" height="32" as="geometry"/></mxCell>
<mxCell id="c16" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FDF3F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="366" y="540" width="120" height="40" as="geometry"/></mxCell>
<mxCell id="c17" value="PSP A  p99 12 s" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="366" y="552" width="120" height="17" as="geometry"/></mxCell>
<mxCell id="c18" 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="366" y="650" width="120" height="40" as="geometry"/></mxCell>
<mxCell id="c19" value="PSP B  p99 380 ms" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="366" y="662" width="120" height="17" as="geometry"/></mxCell>
<mxCell id="c20" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=2;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="154" y="610" as="sourcePoint"/><mxPoint x="202" y="610" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c21" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="314" y="602" as="sourcePoint"/><mxPoint x="364" y="560" as="targetPoint"/><Array as="points"><mxPoint x="340" y="602"/><mxPoint x="340" y="560"/></Array></mxGeometry></mxCell>
<mxCell id="c22" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;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="314" y="618" as="sourcePoint"/><mxPoint x="364" y="670" as="targetPoint"/><Array as="points"><mxPoint x="340" y="618"/><mxPoint x="340" y="670"/></Array></mxGeometry></mxCell>
<mxCell id="c23" value="3 s timeout" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#D93025;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="334" y="522" width="140" height="16" as="geometry"/></mxCell>
<mxCell id="c24" value="new auths after trip" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#1E8E3E;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="344" y="700" width="150" height="16" as="geometry"/></mxCell>
<mxCell id="c25" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#E37400;fillColor=#E37400;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="520" y="76" width="460" height="50" as="geometry"/></mxCell>
<mxCell id="c26" value="B  500 TVs, 40,000 buyers" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=15;fontColor=#FFFFFF;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="90" width="440" height="21" as="geometry"/></mxCell>
<mxCell id="c27" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FDF3F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="520" y="140" width="460" height="170" as="geometry"/></mxCell>
<mxCell id="c28" value="What happened" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="152" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c29" value='Doorbuster: 500 units at 00:00.&lt;br&gt;40,000 checkouts in the first 10 s.&lt;br&gt;Code reads stock, checks &amp;gt; 0, then writes.&lt;br&gt;Hundreds of requests read "available"&lt;br&gt;before any write lands.&lt;br&gt;Result: 731 orders for 500 TVs,&lt;br&gt;231 apology emails and refunds.' style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="182" width="436" height="114" 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="750" y="314" as="sourcePoint"/><mxPoint x="750" y="340" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c31" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#F0F9F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="520" y="346" width="460" height="410" as="geometry"/></mxCell>
<mxCell id="c32" value="Design that holds" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#1E8E3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="358" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c33" value="One atomic statement, no read first:&lt;br&gt;   UPDATE stock SET reserved = reserved + 1&lt;br&gt;   WHERE sku = ? AND on_hand - reserved &amp;gt;= 1&lt;br&gt;Hot SKU split into 10 rows of 50 units&lt;br&gt;   to spread row-lock contention.&lt;br&gt;Reservation expires after 10 minutes.&lt;br&gt;Result: exactly 500 sold, p99 80 ms." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="388" width="436" height="114" as="geometry"/></mxCell>
<mxCell id="c34" value="SKU-TV55 stock split into 10 rows" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="520" width="432" height="17" as="geometry"/></mxCell>
<mxCell id="c35" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="534" y="546" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c36" value="bucket 0&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="562" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c37" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="618" y="546" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c38" value="bucket 1&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="618" y="562" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c39" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="702" y="546" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c40" value="bucket 2&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="702" y="562" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c41" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="786" y="546" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c42" value="bucket 3&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="786" y="562" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c43" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="870" y="546" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c44" value="bucket 4&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="870" y="562" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c45" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="534" y="604" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c46" value="bucket 5&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="620" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c47" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="618" y="604" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c48" value="bucket 6&lt;br&gt;0 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="618" y="620" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c49" 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="702" y="604" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c50" value="bucket 7&lt;br&gt;50 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="702" y="620" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c51" 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="786" y="604" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c52" value="bucket 8&lt;br&gt;50 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="786" y="620" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c53" 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="870" y="604" width="74" height="48" as="geometry"/></mxCell>
<mxCell id="c54" value="bucket 9&lt;br&gt;50 left" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=10;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="870" y="620" width="74" height="30" as="geometry"/></mxCell>
<mxCell id="c55" value="Each request picks a random bucket with stock. Empty buckets are skipped." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="534" y="670" width="432" height="16" as="geometry"/></mxCell>
<mxCell id="c56" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#8430CE;fillColor=#8430CE;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1000" y="76" width="460" height="50" as="geometry"/></mxCell>
<mxCell id="c57" value="C  One tap, two orders" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=15;fontColor=#FFFFFF;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="90" width="440" height="21" as="geometry"/></mxCell>
<mxCell id="c58" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FDF3F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1000" y="140" width="460" height="170" as="geometry"/></mxCell>
<mxCell id="c59" value="What happened" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="152" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c60" value='Shopper taps "Place order" on a train.&lt;br&gt;Request reaches checkout, order is made,&lt;br&gt;card is charged, response is lost.&lt;br&gt;App shows "Something went wrong",&lt;br&gt;shopper taps again.&lt;br&gt;Result: 0.3 % of mobile orders are&lt;br&gt;duplicates, each one a support ticket.' style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="182" width="436" height="114" as="geometry"/></mxCell>
<mxCell id="c61" 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="1230" y="314" as="sourcePoint"/><mxPoint x="1230" y="340" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c62" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#F0F9F2;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1000" y="346" width="460" height="410" as="geometry"/></mxCell>
<mxCell id="c63" value="Design that holds" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;fontColor=#1E8E3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="358" width="440" height="19" as="geometry"/></mxCell>
<mxCell id="c64" value="App makes an Idempotency-Key per&lt;br&gt;   checkout attempt, sends it on retries.&lt;br&gt;Checkout stores key + response for 24 h&lt;br&gt;   (unique index, insert first).&lt;br&gt;Same key, same body → saved response.&lt;br&gt;Same key, different body → 422.&lt;br&gt;Result: duplicates drop to zero." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="388" width="436" height="114" as="geometry"/></mxCell>
<mxCell id="c65" 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="1014" y="580" width="90" height="50" as="geometry"/></mxCell>
<mxCell id="c66" value="App&lt;br&gt;key 7f3a" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="597" width="90" height="32" as="geometry"/></mxCell>
<mxCell id="c67" 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="1164" y="584" width="100" height="40" as="geometry"/></mxCell>
<mxCell id="c68" value="Checkout" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1164" y="596" width="100" height="17" as="geometry"/></mxCell>
<mxCell id="c69" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#8430CE;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1304" y="580" width="140" height="50" as="geometry"/></mxCell>
<mxCell id="c70" value="Key store&lt;br&gt;7f3a → 201 o-88213" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="1304" y="597" width="140" height="32" as="geometry"/></mxCell>
<mxCell id="c71" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=2;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="1104" y="596" as="sourcePoint"/><mxPoint x="1162" y="596" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c72" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;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="1162" y="616" as="sourcePoint"/><mxPoint x="1104" y="616" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c73" style="edgeStyle=none;html=1;rounded=0;strokeColor=#8430CE;strokeWidth=2;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="1264" y="604" as="sourcePoint"/><mxPoint x="1302" y="604" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c74" value="retry #2, same key" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1014" y="542" width="200" height="16" as="geometry"/></mxCell>
<mxCell id="c75" value="saved 201, no new charge" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#1E8E3E;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1074" y="644" width="220" height="16" as="geometry"/></mxCell></root></mxGraphModel></diagram>
</mxfile>
