world 8B, 10% users from pop = 0.8B
system DAU will be 10% of users = 80M
R:W = 10:1
W DAU
1x1
POST /v1/file {file info}-> return {status, error code, location url}
batch
POST /v1/files {files info}-> return {status, error code, location url}
download a file
GET /v1/file/id
GET /v1/files/id={id1, id2,..}
get file info, to finalize upload
Get /v1/fileinfo/id
all above API using JWT as user security token to access endpoints
fileInfo: fileId, name, author, chunkIds:[], updated, created
chunkInfo: fileId, chunkId, chunkUrl
upload(fileId)
👉 Design intent
👉 Why first write to S3?
POST upload(fileInfo)
fileInfo {
fileId,
name,
author,
created,
updated
}
👉 Design intent
topic: file-uploaded
👉 This triggers downstream processing pipeline
A dedicated Object Handler Service consumes Kafka events:
Raw S3 Object
↓
Split into chunks
↓
Fraud Detection
↓
Compression Service
👉 Why pipeline?
👉 Guarantees:
topic: chunk-created
chunkInfo {
fileId,
chunkId,
chunkUrl
}
👉 Design intent
👉 If hit → return immediately
👉 If miss → go backend
[
{chunkId, chunkUrl},
...
]
👉 Why client-side merge?
Failover / Replication Design
For example:
Then:
3. Failover strategy
During failover, the system promotes the most up-to-date replica as the new primary, typically the one with the smallest replication lag or the latest committed log position.