-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference.html
More file actions
180 lines (158 loc) · 8.63 KB
/
Copy pathreference.html
File metadata and controls
180 lines (158 loc) · 8.63 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SysScale — Reference</title>
<meta name="description" content="Capacity estimation cheat sheet, latency numbers, component throughput, and full glossary.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/tokens.css">
<script>!function(){var t=localStorage.getItem("ss_theme")||"light";document.documentElement.setAttribute("data-theme",t)}();</script>
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/components.css">
<link rel="stylesheet" href="css/animations.css">
<link rel="stylesheet" href="css/pages.css">
<script src="js/utils/theme.js"></script>
</head>
<body>
<header class="header">
<a href="index.html" class="logo"><span class="logo-mark">SS</span>SysScale</a>
<span class="header-sep"></span>
<nav class="header-nav">
<a href="index.html" class="header-tab">Home</a>
<a href="estimator.html" class="header-tab">Estimator</a>
<a href="learn.html" class="header-tab">Learn</a>
<a href="practice.html" class="header-tab">Practice</a>
<a href="reference.html" class="header-tab active">Reference</a>
</nav>
<div class="header-right">
<button class="export-btn" onclick="window.print()" title="Print reference">⬇ Print</button>
<button id="theme-btn" onclick="SS.toggleTheme()" title="Dark mode">🌙</button>
<div id="nav-auth"></div>
<span class="version-badge">v4.0</span>
</div>
</header>
<div class="page-wrap">
<div class="page-container">
<div class="page-title">Reference</div>
<div class="page-subtitle">Everything you need to know cold on interview day. Keep this open in another tab.</div>
<div class="reference-grid">
<!-- Left column: cheat sheet -->
<div class="reference-panel">
<div class="tips-box">
<div class="tips-box-head">Universal constants</div>
<ul class="tips-list">
<li>1 day = <strong>86,400 seconds</strong></li>
<li>1 month ≈ 2.5 M seconds · 1 year ≈ 31.5 M seconds</li>
<li>Peak multiplier: <strong>5× average</strong> (consumer APIs) · <strong>10×</strong> (notifications / events)</li>
<li>Concurrent users ≈ <strong>10% of DAU</strong> at any moment</li>
<li>Read/write ratio typical: <strong>100:1</strong> for social feeds, <strong>10:1</strong> for e-commerce</li>
</ul>
</div>
<div class="tips-box">
<div class="tips-box-head">The 5-step framework</div>
<ul class="tips-list">
<li><strong>Clarify:</strong> state assumptions, scale, consistency, edge cases — out loud</li>
<li><strong>Traffic:</strong> DAU × actions/day ÷ 86,400 = avg RPS → ×5 (or ×10) = peak</li>
<li><strong>Storage:</strong> entities/day × bytes/entity × retention days</li>
<li><strong>Bandwidth:</strong> peak RPS × payload × 8 bits = bps</li>
<li><strong>Scale:</strong> ops_needed ÷ component_capacity = nodes → ×3 replication</li>
</ul>
</div>
<div class="tips-box">
<div class="tips-box-head">Component throughput</div>
<table class="metrics-table">
<tr><td>Redis single node</td><td class="hl">~100K ops/s</td></tr>
<tr><td>MySQL / Postgres write</td><td class="hl">5K–10K/s</td></tr>
<tr><td>Cassandra per node</td><td class="hl">~50K writes/s</td></tr>
<tr><td>Kafka single broker</td><td class="hl">~1M msgs/s</td></tr>
<tr><td>Elasticsearch per node</td><td class="hl">~5K writes/s</td></tr>
<tr><td>S3 / object storage</td><td class="hl">~3.5K req/s per prefix</td></tr>
<tr><td>Load balancer (L7)</td><td class="hl">~100K req/s</td></tr>
<tr><td>SSD random IOPS</td><td class="hl">100K IOPS</td></tr>
<tr><td>HDD sequential</td><td class="hl">100 MB/s</td></tr>
</table>
</div>
<div class="tips-box">
<div class="tips-box-head">Latency numbers (know these cold)</div>
<table class="metrics-table">
<tr><td>L1 cache reference</td><td class="hl">~0.5 ns</td></tr>
<tr><td>L2 cache reference</td><td class="hl">~7 ns</td></tr>
<tr><td>RAM access</td><td class="hl">~100 ns</td></tr>
<tr><td>SSD random read</td><td class="hl">~150 μs</td></tr>
<tr><td>HDD random read</td><td class="hl">~10 ms</td></tr>
<tr><td>Same-DC network RTT</td><td class="hl">~0.5 ms</td></tr>
<tr><td>Cross-region RTT (US↔EU)</td><td class="hl">~80 ms</td></tr>
<tr><td>Cross-region RTT (US↔Asia)</td><td class="hl">~150 ms</td></tr>
<tr><td>TCP handshake (local)</td><td class="hl">~1 ms</td></tr>
</table>
</div>
<div class="tips-box">
<div class="tips-box-head">Storage sizes</div>
<table class="metrics-table">
<tr><td>UUID / GUID</td><td class="hl">16 B</td></tr>
<tr><td>Unix timestamp (int64)</td><td class="hl">8 B</td></tr>
<tr><td>Average user record</td><td class="hl">~1 KB</td></tr>
<tr><td>Tweet / short message</td><td class="hl">~200–500 B</td></tr>
<tr><td>Redis key overhead</td><td class="hl">~60 B</td></tr>
<tr><td>MySQL row overhead</td><td class="hl">~100 B</td></tr>
<tr><td>Photo (JPEG compressed)</td><td class="hl">~300 KB</td></tr>
<tr><td>Video 1 min 720p</td><td class="hl">~50 MB</td></tr>
<tr><td>Video 1 min 4K</td><td class="hl">~375 MB</td></tr>
</table>
</div>
</div>
<!-- Right column: glossary -->
<div class="reference-panel">
<div class="tips-box">
<div class="tips-box-head">Powers of 2</div>
<table class="metrics-table">
<tr><td>2<sup>10</sup> = 1 KB</td><td class="hl">1,024</td></tr>
<tr><td>2<sup>20</sup> = 1 MB</td><td class="hl">1,048,576</td></tr>
<tr><td>2<sup>30</sup> = 1 GB</td><td class="hl">1,073,741,824</td></tr>
<tr><td>2<sup>40</sup> = 1 TB</td><td class="hl">~1 trillion</td></tr>
<tr><td>2<sup>50</sup> = 1 PB</td><td class="hl">~1 quadrillion</td></tr>
</table>
</div>
<div class="tips-box">
<div class="tips-box-head">Quick rules of thumb</div>
<ul class="tips-list">
<li><strong>1M users × 1 KB</strong> = 1 GB storage</li>
<li><strong>1M req/day</strong> ÷ 86,400 ≈ <strong>12 RPS</strong></li>
<li><strong>100M DAU × 10 actions</strong> = ~12K avg RPS (×5 peak = 60K RPS)</li>
<li><strong>1 TB/day</strong> ÷ 86,400 ≈ 12 MB/s ingress</li>
<li><strong>Replication factor 3</strong> → multiply raw storage × 3</li>
<li><strong>Index overhead</strong> ≈ 10–20% on top of data size</li>
</ul>
</div>
<div class="tips-box" id="glossary-box">
<div class="tips-box-head">Glossary</div>
<div class="glossary-list" id="glossary-list">
<div style="font-size:11px;color:var(--text3);padding:8px 0">Loading…</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/utils/glossary.js"></script>
<script>
(function () {
var list = document.getElementById('glossary-list');
var glossary = window.SS && window.SS.GLOSSARY;
if (!glossary) { list.innerHTML = '<div style="font-size:11px;color:var(--text3);padding:8px 0">Glossary unavailable.</div>'; return; }
var terms = Object.keys(glossary).sort(function (a, b) { return a.localeCompare(b); });
list.innerHTML = terms.map(function (term) {
return '<div class="glossary-entry">' +
'<div class="glossary-term-label">' + term + '</div>' +
'<div class="glossary-def">' + glossary[term] + '</div>' +
'</div>';
}).join('');
})();
</script>
<script src="js/auth/firebase-init.js"></script>
</body>
</html>