Skip to content

Commit e898aa7

Browse files
committed
docs(system design plan): based on ticketmaster
1 parent 438f8a9 commit e898aa7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
Author:
3+
- Xinyang YU
4+
Author Profile:
5+
- https://linkedin.com/in/xinyang-yu
6+
tags:
7+
- system_design
8+
Creation Date: 2025-11-01, 19:58
9+
Last Date: 2025-11-01T19:59:44+08:00
10+
References:
11+
draft:
12+
description:
13+
---
14+
## System Design Plan
15+
---
16+
### Step 1 (Requirements)
17+
- Hybrid CAP.
18+
- Non-functional considerations with context.
19+
- Clarify what is in-scope and out-of-scope.
20+
21+
22+
### Step 2 (Core Entities & API)
23+
- Identify high-level DB entities (don’t worry about attributes yet).
24+
- User info embedded in the JWT header, so it can’t be altered.
25+
26+
27+
### Step 3 (High-Level Design)
28+
- Map out the architecture diagram.
29+
- Determine the type and quality of database needed (both NoSQL and SQL can work).
30+
- Start simple without optimization; cover all functional requirements first.
31+
- Abstract out the payment component (provide a callback endpoint to receive payment confirmations).
32+
- Use distributed locks with auto-TTL to keep the data model clean (mid-level candidates may only think of cron jobs).
33+
34+
35+
### Step 4 (Deep Dive (the differentiator))
36+
- Reference relevant non-functional requirements.
37+
- **ElasticSearch** for fast search using inverted indexes; cannot be the main DB since it can’t handle complex transaction management.
38+
- **Change Data Capture (CDC):** changes in the primary DB are streamed to update ElasticSearch. Heavy updates may require a queue or batching.
39+
- **Caching complexities (especially with ranking):**
40+
- Might require sticky sessions.
41+
- AWS OpenSearch supports node query caching for faster queries without adding external caching layers.
42+
- Alternatively, Redis works, but invalidation must be handled carefully when primary DB changes.
43+
- CDN caching works for static content but loses effectiveness with high key permutations or timestamp-driven keys. User-specific results also reduce usefulness.
44+
- **Real-time UX improvements:**
45+
- **Long polling:** cheap and easy, especially if users remain on a page for a few minutes.
46+
- **Server-Sent Events (SSE):** simpler than WebSockets if communication is server → client only.
47+
- **Choke Point (virtual waiting queue):**
48+
- Prevents instant access and avoids “fastest click wins” behavior.
49+
- Redis can be used.
50+
- Similar to a rate limiter but with better UX.
51+
52+
53+
## Misc
54+
---
55+
56+
### When to shard
57+
- High write throughput, vertical scaling exhausted.
58+
- Excessive data volume.
59+
- Hotspot keys causing uneven load.
60+
61+
### When **not** to shard
62+
- Strong global consistency required.
63+
- Queries frequently join large tables (sharding increases fan-out).
64+
- Operational maturity is low.
65+
66+
## References
67+
---
68+
- [System Design Interview: Design Ticketmaster w/ a Ex-Meta Staff Engineer - YouTube](https://youtu.be/fhdPyoO6aXI?si=dI9umvuXx-jTOMUR)

0 commit comments

Comments
 (0)