Skip to content

Commit f7b1106

Browse files
author
LeadTechInterview
committed
🎉auto update by Gmeek action
1 parent fabe4a5 commit f7b1106

File tree

8 files changed

+608
-19
lines changed

8 files changed

+608
-19
lines changed

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lead Tech Interview :link: https://leadtechinterview.github.io
2-
### :page_facing_up: [16](https://leadtechinterview.github.io/tag.html)
2+
### :page_facing_up: [17](https://leadtechinterview.github.io/tag.html)
33
### :speech_balloon: 0
4-
### :hibiscus: 70422
5-
### :alarm_clock: 2025-01-16 04:39:39
4+
### :hibiscus: 73305
5+
### :alarm_clock: 2025-01-16 09:02:37
66
### Powered by :heart: [Gmeek](https://github.com/Meekdai/Gmeek)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Requirements (5 mins):
2+
3+
## Functional Requirements
4+
5+
> Identify core features (e.g., "Users should be able to post tweets"). Prioritize 2-3 key features.
6+
7+
1. users can start/stop/pause their activity (runs/rides)
8+
2. users should be able to check the activity data (route, distance, time etc) when running /riding
9+
3. users should be able to check history records, including friends
10+
11+
## Non-Functional Requirements
12+
13+
> Focus on system qualities like scalability, latency, and availability, consistency, security, durability, fault tolerance. Quantify where possible (e.g., "render feeds in under 200ms").
14+
15+
1. the system should be highly available
16+
2. the app should work offline when no Internet
17+
3. the stats should be accurate
18+
4. should support 10m concurrent users
19+
20+
## Capacity Estimation
21+
22+
> Skip unnecessary calculations unless they directly impact the design (e.g., sharding in a TopK system).
23+
24+
route GPS data estimation: 100m DAU, 10m concurrent users, collect interval 5 secs, 30 min activity per day will generate 30 x 60 / 5 = 360 records, so around 36,000m records per day, each record we have around 40 Byte.
25+
26+
Storage: 36,000m x 40 = 1440GB per day. 1500G x 360 = 180000x3G = 540000 GB = 540 TB
27+
28+
QPS 3600m / 100k = 36k
29+
30+
## Core Entities (2 mins)
31+
32+
> Identify key entities (e.g., User, Tweet, Follow) to define the system's foundation.
33+
34+
- user
35+
- activity
36+
- route
37+
- friend
38+
39+
# API/System Interface (5 mins)
40+
41+
> Define the contract between the system and users. Prefer RESTful APIs unless GraphQL is necessary.
42+
43+
- POST /activity -> Activity, create an activity, body {type}
44+
- PATCH /activity/id, change status, body { status}, start, stop, pause, complete
45+
- POST /activity/id/route, update route geo tracking { geolocation}
46+
- GET /activities/page?mode=user|friend&page=
47+
48+
# [Optional] Data Flow (5 mins)
49+
50+
> Describe high-level processes for data-heavy systems (e.g., web crawlers).
51+
52+
# High-Level Design (10-15 mins)
53+
54+
> Draw the system architecture, focusing on core components (e.g., servers, databases). Keep it simple and iterate based on API endpoints.
55+
56+
![image](https://github.com/user-attachments/assets/68ced8bb-4916-49f8-a3cd-8d56576a1688)
57+
58+
59+
# Deep Dives (10 mins)
60+
61+
> Address non-functional requirements, edge cases, and bottlenecks. Proactively improve the design (e.g., scaling, caching, database sharding).
62+
63+
## No internet connection
64+
65+
We can save data in local db and sync to server later
66+
67+
## Support 100 DAU, 10m concurrent users
68+
69+
storage: 540TB/year
70+
71+
- purge old storage of route date
72+
- shard data by time
73+
- use cold storage to save cost
74+
- compress the date
75+
76+
QPS: 40k
77+
78+
- use nosql database, time series database more specific
79+
- clients aggregate the data and use longer intervals if not in realtime view
80+
- shard the data by user id, activity id to distribute the load across servers
81+

‎blogBase.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/index.html‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,18 @@ <h1>
8080
<div id="content">
8181
<div style="margin-bottom: 16px;">Preparing for the Big Leap</div>
8282
<nav class="SideNav border">
83-
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Coding%20question-%20Happy%20Number.html">
83+
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/System%20Design%20Strava.html">
84+
<div class="d-flex flex-items-center">
85+
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
86+
</svg>
87+
<span class="listTitle">System Design Strava</span>
88+
</div>
89+
<div class="listLabels">
90+
91+
<span class="Label LabelName" style="background-color:#54E34A"><object><a style="color:#fff" href="tag.html#system design">system design</a></object></span>
92+
<span class="Label LabelTime" style="background-color:#0969da">2025-01-16</span>
93+
</div>
94+
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Coding%20question-%20Happy%20Number.html">
8495
<div class="d-flex flex-items-center">
8596
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
8697
</svg>
@@ -234,17 +245,6 @@ <h1>
234245
<span class="Label LabelName" style="background-color:#54E34A"><object><a style="color:#fff" href="tag.html#system design">system design</a></object></span>
235246
<span class="Label LabelTime" style="background-color:#0969da">2025-01-10</span>
236247
</div>
237-
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Creating%20Back%20of%20Envelope%20Quizzes%20for%20Tech%20Interviews%20using%20AI.html">
238-
<div class="d-flex flex-items-center">
239-
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
240-
</svg>
241-
<span class="listTitle">Creating Back of Envelope Quizzes for Tech Interviews using AI</span>
242-
</div>
243-
<div class="listLabels">
244-
245-
<span class="Label LabelName" style="background-color:#54E34A"><object><a style="color:#fff" href="tag.html#system design">system design</a></object></span>
246-
<span class="Label LabelTime" style="background-color:#0969da">2025-01-10</span>
247-
</div>
248248
</a>
249249
</nav><nav class="paginate-container" aria-label="Pagination">
250250
<div class="pagination"><span class="previous_page" aria-disabled="true">上一页</span>

‎docs/page2.html‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,18 @@ <h1>
8080
<div id="content">
8181
<div style="margin-bottom: 16px;">Preparing for the Big Leap</div>
8282
<nav class="SideNav border">
83-
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Simplified%20Back-of-the-Envelope%20Calculation%20Cheat%20Sheet.html">
83+
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Creating%20Back%20of%20Envelope%20Quizzes%20for%20Tech%20Interviews%20using%20AI.html">
84+
<div class="d-flex flex-items-center">
85+
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
86+
</svg>
87+
<span class="listTitle">Creating Back of Envelope Quizzes for Tech Interviews using AI</span>
88+
</div>
89+
<div class="listLabels">
90+
91+
<span class="Label LabelName" style="background-color:#54E34A"><object><a style="color:#fff" href="tag.html#system design">system design</a></object></span>
92+
<span class="Label LabelTime" style="background-color:#0969da">2025-01-10</span>
93+
</div>
94+
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Simplified%20Back-of-the-Envelope%20Calculation%20Cheat%20Sheet.html">
8495
<div class="d-flex flex-items-center">
8596
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
8697
</svg>

0 commit comments

Comments
 (0)