-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchitecture.drawio
188 lines (188 loc) · 17.1 KB
/
architecture.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<mxfile host="65bd71144e">
<diagram id="PvlTUjPj0u4iXz4PkVxB" name="Page-1">
<mxGraphModel dx="1780" dy="1879" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="92" value="" style="whiteSpace=wrap;html=1;shape=mxgraph.basic.document" parent="1" vertex="1">
<mxGeometry x="1045" y="200" width="495" height="460" as="geometry"/>
</mxCell>
<mxCell id="71" value="" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="190" y="315" width="375" height="335" as="geometry"/>
</mxCell>
<mxCell id="66" value="" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="220" y="800" width="470" height="260" as="geometry"/>
</mxCell>
<mxCell id="61" value="" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="645" y="200" width="380" height="570" as="geometry"/>
</mxCell>
<mxCell id="2" value="Short URL Service" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="335" y="475" width="150" height="120" as="geometry"/>
</mxCell>
<mxCell id="3" value="Short URL Service" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="345" y="485" width="150" height="120" as="geometry"/>
</mxCell>
<mxCell id="4" value="Short URL Service" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="355" y="495" width="150" height="120" as="geometry"/>
</mxCell>
<mxCell id="11" style="edgeStyle=none;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="5" target="69" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="840" y="685" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="28" style="edgeStyle=none;html=1;startArrow=none;" parent="1" source="27" target="26" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="64" style="edgeStyle=none;html=1;" parent="1" source="5" target="8" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="65" style="edgeStyle=none;html=1;" parent="1" source="5" target="63" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="5" value="Short URL Service" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="365" y="505" width="150" height="120" as="geometry"/>
</mxCell>
<mxCell id="8" value="Postgres<br>Master" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="1" vertex="1">
<mxGeometry x="670" y="475" width="110" height="80" as="geometry"/>
</mxCell>
<mxCell id="30" style="edgeStyle=none;html=1;" parent="1" source="26" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="440" y="840" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="26" value="" style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=none;fillColor=#B0084D;strokeColor=none;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;pointerEvents=1;shape=mxgraph.aws4.mq_broker;" parent="1" vertex="1">
<mxGeometry x="401" y="710" width="78" height="78" as="geometry"/>
</mxCell>
<mxCell id="29" value="" style="edgeStyle=none;html=1;endArrow=none;" parent="1" source="5" target="27" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="440" y="625" as="sourcePoint"/>
<mxPoint x="440" y="714.6250454545454" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="27" value="Message Broker<br>(SQS, PubSub, RabbitMQ)" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="355" y="665" width="170" height="40" as="geometry"/>
</mxCell>
<mxCell id="55" style="edgeStyle=none;html=1;entryX=0;entryY=0;entryDx=0;entryDy=0;" parent="1" source="31" target="56" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="520" y="960" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="58" style="edgeStyle=none;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;" parent="1" source="31" target="57" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="370" y="960" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="31" value="Collector Service" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="380" y="830" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="91" style="edgeStyle=none;html=1;" parent="1" source="52" target="89" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="52" value="Entity" style="swimlane;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;rounded=1;fontSize=14;fontStyle=0;strokeWidth=2;resizeParent=0;resizeLast=1;shadow=0;dashed=0;align=center;" parent="1" vertex="1">
<mxGeometry x="660" y="310" width="250" height="125" as="geometry"/>
</mxCell>
<mxCell id="53" value="+ id UUIDv4 (36 bytes?) + original_url TEXT (65,535 bytes) + short_url VARCHAR(20) (6 * 1bytes?) + number_of_access INT (4 bytes) + created_at TimestampTZ (8 bytes) + updated_at TimestampTZ (8 bytes) " style="align=left;strokeColor=none;fillColor=none;spacingLeft=4;fontSize=12;verticalAlign=top;resizable=0;rotatable=0;part=1;" parent="52" vertex="1">
<mxGeometry y="30" width="250" height="95" as="geometry"/>
</mxCell>
<mxCell id="56" value="Observability Stack<br>(Dashboards, Metrics, Logs, Spans)" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="500" y="960" width="145" height="60" as="geometry"/>
</mxCell>
<mxCell id="57" value="BI Squad (Dashboards, Data Analysis)" style="whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="960" width="140" height="60" as="geometry"/>
</mxCell>
<mxCell id="59" value="Eviction Policy: LRU<br>Expiration Policy: None since there is no updates" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="750" y="630" width="280" height="40" as="geometry"/>
</mxCell>
<mxCell id="60" value="<div style=""><span style="background-color: initial;">Auto managed DB on&nbsp;</span><span style="background-color: initial;">any cloud provider,</span></div><div style=""><span style="background-color: initial;">preferably one that scale horizontaly</span></div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="775" y="510" width="240" height="40" as="geometry"/>
</mxCell>
<mxCell id="62" value="STORAGE SPACE" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="645" y="200" width="130" height="30" as="geometry"/>
</mxCell>
<mxCell id="63" value="Postgres<br>Read Replica" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="1" vertex="1">
<mxGeometry x="670" y="570" width="110" height="80" as="geometry"/>
</mxCell>
<mxCell id="67" value="OBSERVABILITY SPACE" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="220" y="800" width="160" height="30" as="geometry"/>
</mxCell>
<mxCell id="69" value="Distributed Cache<br>(Maybe use Cache Warming)" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="805" y="670" width="170" height="90" as="geometry"/>
</mxCell>
<mxCell id="72" value="MICROSERVICES SPACE" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="190" y="315" width="170" height="30" as="geometry"/>
</mxCell>
<mxCell id="73" value="Auto Managed Container<br>(Fargate, EKS, ECS Tasks, etc)" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="270" y="430" width="190" height="40" as="geometry"/>
</mxCell>
<mxCell id="78" style="edgeStyle=none;html=1;" parent="1" source="75" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="75" value="APM" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="479" y="315" width="80" height="80" as="geometry"/>
</mxCell>
<mxCell id="79" style="edgeStyle=none;html=1;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="76" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="76" value="Secret Manager" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="190" y="570" width="80" height="80" as="geometry"/>
</mxCell>
<mxCell id="86" style="edgeStyle=none;html=1;entryX=0.534;entryY=0.002;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="82" target="71" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="82" value="<b>Application Load Balancer</b>" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.application_load_balancer;fillColor=#F58534;gradientColor=none;" parent="1" vertex="1">
<mxGeometry x="355" y="158" width="69" height="72" as="geometry"/>
</mxCell>
<mxCell id="88" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="87" target="82" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="389.4999999999999" y="128.00000000000023" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="87" value="<b>WAF</b><br>(could be Cloudflare as well)" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.waf;fillColor=#759C3E;gradientColor=none;" parent="1" vertex="1">
<mxGeometry x="351.25" y="-50" width="76.5" height="93" as="geometry"/>
</mxCell>
<mxCell id="89" value="<font style="font-size: 13px;">Maximum size per entry: 65,597 Bytes ~ 65M</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1045" y="250" width="280" height="30" as="geometry"/>
</mxCell>
<mxCell id="90" value="Example of a use case where:" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1045" y="300" width="200" height="30" as="geometry"/>
</mxCell>
<mxCell id="93" value="Creation =&gt; 5000 RPS<br>Reading =&gt; 10:1 (every 10 reads 1 write)" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1045" y="330" width="260" height="40" as="geometry"/>
</mxCell>
<mxCell id="94" value="5000 * 60 * 60 * 24 * 365 = 157 billions of urls created each year" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1045" y="405" width="390" height="30" as="geometry"/>
</mxCell>
<mxCell id="95" value="Summary Per Year we have:<br>~157 billions of new URLs<br>~1.5 trillions of reads&nbsp;" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1050" y="445" width="190" height="60" as="geometry"/>
</mxCell>
<mxCell id="96" value="A base64 hash with only 6 digits can generate a maximum number of ~64 billions&nbsp;" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1045" y="525" width="490" height="30" as="geometry"/>
</mxCell>
<mxCell id="97" value="base64^6 ~ 64 billions<br>base64^7 ~ 4 trillions&nbsp; =&gt; Ideal for this use case" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="1045" y="550" width="300" height="40" as="geometry"/>
</mxCell>
<mxCell id="100" style="edgeStyle=none;html=1;fontSize=13;" parent="1" source="99" target="87" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="99" value="" style="shape=actor;whiteSpace=wrap;html=1;fontSize=13;" parent="1" vertex="1">
<mxGeometry x="369.5" y="-230" width="40" height="60" as="geometry"/>
</mxCell>
<mxCell id="101" value="<b style="font-size: 14px;">SOME METRICS</b>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=14;" parent="1" vertex="1">
<mxGeometry x="1045" y="200" width="130" height="30" as="geometry"/>
</mxCell>
<mxCell id="103" style="edgeStyle=none;html=1;entryX=0.013;entryY=0.067;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="102" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="107" style="edgeStyle=none;html=1;" parent="1" source="102" target="105" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="102" value="JOBS" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="200" y="370" width="80" height="80" as="geometry"/>
</mxCell>
<mxCell id="105" value="Job responsible to process async operations" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="-90" y="395" width="260" height="30" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>