Instagram, layer by layerInstagram, từng tầng một

Instagram is one monolith.Standing on a platform of services.Instagram là một monolith.Đứng trên một nền tảng service.

The product logic lives in one Django codebase with one deploy. The scale lives underneath, in shared Meta systems for the graph, storage, ranking and delivery. Copy both halves, or neither.Logic sản phẩm nằm trong một codebase Django, một lần triển khai. Quy mô nằm bên dưới, trong các hệ thống dùng chung của Meta cho đồ thị, lưu trữ, ranking và truyền tải. Chép cả hai nửa, hoặc đừng chép.

Instagram stack: clients, the Django monolith, and Meta platform services beneath it iOS + Android Web GraphQL QUIC / HTTP/3 + MobileConfig Django monolith all product logic · one repo · one deploy toàn bộ logic sản phẩm · một repo · một deploy Python 3 on Cinder TAO Postgres Cassandra Ranking Queue Everstore Tectonic
Above the green slab: what the chart calls Instagram. Below it: what actually carries the scale. The dashed line is one request at runtime, leaving the monolith for platform services.Trên khối xanh lá: thứ mà ảnh gọi là Instagram. Bên dưới: thứ thật sự gánh quy mô. Nét đứt là một request lúc chạy, rời monolith để xuống các service nền tảng.

Which one do you need?Bạn cần cái nào?

Start from the baseline. Move down the tree only with a measured bottleneck in hand.Bắt đầu từ baseline. Chỉ đi xuống cây khi đã có nút thắt đo được trong tay.

Baseline: none of the aboveBaseline: không cần gì trong ảnh

Instagram launched in 2010 on exactly this, and had 13 employees at about 30 million users.Instagram ra mắt năm 2010 với đúng bộ này, và chỉ có 13 nhân viên khi đạt khoảng 30 triệu người dùng.

1 Django / Rails / Laravel app
+ 1 Postgres (+ read replica)
+ S3-style storage + CDN
+ Redis (cache + small queue)
+ workers in the same repo
Stay here while:Ở lại đây khi:
  • one Postgres handles your writesmột Postgres còn chịu được tải ghi
  • the feed sorts by time or a simple SQL scorefeed sắp theo thời gian hoặc công thức SQL đơn giản
  • media fits managed storage + CDNmedia vừa object storage + CDN
  • deploys don’t block each othercác lần triển khai không chặn nhau
Measured bottleneck?
├─ No ─────────────────────► stay on baseline
└─ Yes, where?
   ├─ teams collide in code ─► modular monolith (B1)
   ├─ DB reads ──────────────► cache + replicas
   ├─ graph reads at scale ──► TAO-style cache (B3)
   ├─ DB writes, relational ─► shard Postgres (B2)
   ├─ huge writes, by key ───► Cassandra (B2)
   ├─ media < few PB ────────► S3 + CDN
   ├─ media 100s of PB ──────► own blob store (M1, M2)
   ├─ candidates in millions ► retrieval → rank (R1–R3)
   ├─ screens = many calls ──► GraphQL / BFF (C3)
   ├─ flaky networks ────────► HTTP/3 at the CDN (D1)
   ├─ need a kill switch ────► remote config (D2)
   └─ slow work in request ──► async queue (D3)
Có nút thắt đo được?
├─ Chưa ───────────────────► ở lại baseline
└─ Có, ở đâu?
   ├─ nhiều đội giẫm code ───► modular monolith (B1)
   ├─ DB quá tải đọc ────────► cache + replica
   ├─ đọc đồ thị lớn ────────► cache kiểu TAO (B3)
   ├─ DB quá tải ghi, quan hệ► shard Postgres (B2)
   ├─ ghi cực lớn, theo khoá ► Cassandra (B2)
   ├─ media < vài PB ────────► S3 + CDN
   ├─ media hàng trăm PB ────► kho blob riêng (M1, M2)
   ├─ ứng viên hàng triệu ───► retrieval → rank (R1–R3)
   ├─ màn hình gọi nhiều API ► GraphQL / BFF (C3)
   ├─ mạng chập chờn ────────► HTTP/3 ở CDN (D1)
   ├─ cần kill switch ───────► remote config (D2)
   └─ việc chậm trong request► async queue (D3)

The fifteen piecesMười lăm mảnh ghép

Each card leads with its trade-off. Read that line first; the rest explains it.Mỗi card mở đầu bằng câu đánh đổi. Đọc câu đó trước, phần còn lại giải thích nó.

ClientClient

C1

Native appsApp native

iOS + AndroidiOS + Android

Trades development speed and two teams’ cost for smoothness and hardware access.Đổi tốc độ phát triển và chi phí hai đội lấy độ mượt và quyền truy cập phần cứng.

Two apps, one per platform, with direct access to camera, GPU and push. Installed builds can’t be patched.Hai app riêng cho từng nền tảng, truy cập thẳng camera, GPU, thông báo đẩy. Bản đã cài thì không vá được.

Use forDùng cho
  • Camera and editing appsApp camera, chỉnh sửa ảnh/video
  • Feeds that must stay smooth at 60–120 fpsFeed cần mượt 60–120 fps
  • Partly offline useDùng được một phần khi offline
You gainĐược
  • Best performance per platformHiệu năng tốt nhất trên mỗi nền tảng
  • Full OS APIs on day oneĐủ API hệ điều hành ngay khi ra mắt
You loseMất
  • Two codebases, two teamsHai codebase, hai đội
  • Old versions linger for monthsBản cũ tồn tại hàng tháng

Tell-tale signDấu hiệu nhận biết The core feature touches hardware.Tính năng chính đụng tới phần cứng.

C2

WebWeb

ReactReact

Trades hardware access for instant releases to everyone.Đổi quyền truy cập phần cứng lấy khả năng phát hành tức thì cho mọi người.

instagram.com is a React app on the same backend. Every deploy reaches every user at once.instagram.com là app React dùng chung backend. Mỗi lần triển khai là tới mọi người dùng ngay.

Use forDùng cho
  • Desktop browsing and DMsDùng trên máy tính, nhắn tin desktop
  • Public pages that need SEOTrang công khai cần SEO
  • Fast experimentsThử nghiệm nhanh
You gainĐược
  • Instant releases, no reviewPhát hành tức thì, không qua review
  • Shares API with mobileDùng chung API với mobile
You loseMất
  • Weak at camera and heavy mediaYếu ở camera và media nặng
  • JS bundles slow first loadBundle JS làm chậm lần tải đầu

Tell-tale signDấu hiệu nhận biết Traffic arrives from search or from laptops.Traffic đến từ Google hoặc từ laptop.

C3

GraphQLGraphQL

one typed request per screenmột request có kiểu cho mỗi màn hình

Trades REST’s simplicity and HTTP caching for fewer round trips and a typed contract.Đổi sự đơn giản và cache HTTP của REST lấy ít round trip và hợp đồng có kiểu.

The client asks for exactly the shape it needs; the server answers in one call. Meta sends precompiled queries by ID.Client mô tả đúng dữ liệu cần, server trả trong một lần gọi. Ở Meta query được biên dịch sẵn và gửi bằng ID.

Use forDùng cho
  • Screens that combine many sourcesMàn hình ghép dữ liệu nhiều nguồn
  • Several clients with different needsNhiều client cần dữ liệu khác nhau
You gainĐược
  • Fewer round trips on mobileÍt round trip trên mobile
  • Typed schema, generated client codeSchema có kiểu, sinh code client
You loseMất
  • HTTP caching mostly goneGần như mất cache HTTP
  • N+1 queries without batchingN+1 query nếu không batch

Tell-tale signDấu hiệu nhận biết One screen calls four or more endpoints.Một màn hình gọi từ 4 endpoint trở lên.

Application & dataỨng dụng & dữ liệu

B1

Django monolithDjango monolith

Python on Cinder, millions of linesPython trên Cinder, hàng triệu dòng

Trades independent scaling and deploys for cross-feature speed and simple operations.Đổi khả năng mở rộng và triển khai độc lập lấy tốc độ thay đổi xuyên tính năng và vận hành đơn giản.

All product logic in one codebase and one deploy. Heavy lifting is delegated to shared infrastructure services.Toàn bộ logic sản phẩm trong một codebase, một lần triển khai. Phần nặng giao cho service hạ tầng dùng chung.

Use forDùng cho
  • Features that share user dataTính năng dùng chung dữ liệu người dùng
  • Teams with a strong infra platformCông ty có nền tảng hạ tầng tốt
You gainĐược
  • Cross-module refactor in one commitRefactor xuyên module trong một commit
  • No network hops between modulesKhông có lời gọi mạng giữa module
You loseMất
  • One bug can slow everythingMột bug có thể làm chậm tất cả
  • Test/deploy time grows with codeThời gian test/triển khai tăng theo code

Tell-tale signDấu hiệu nhận biết Every new feature needs users, follows and privacy.Tính năng mới nào cũng cần user, follow, quyền riêng tư.

B2

Postgres + CassandraPostgres + Cassandra

sharded SQL + wide columnSQL sharded + wide column

Trades global joins and transactions for write capacity beyond one machine.Đổi join và transaction toàn cục lấy khả năng ghi vượt giới hạn một máy.

Postgres split by user for relational data; Cassandra for write-heavy key lookups like feeds and inboxes.Postgres chia theo người dùng cho dữ liệu quan hệ; Cassandra cho dữ liệu ghi nhiều, đọc theo khoá như feed, inbox.

Use forDùng cho
  • User data beyond one serverDữ liệu người dùng vượt một máy
  • Feeds, inboxes, activity logsFeed, hộp thư, nhật ký hoạt động
You gainĐược
  • Writes scale with shard countKhả năng ghi mở rộng theo số shard
  • One shard down hits few usersLỗi một shard chỉ ảnh hưởng một phần
You loseMất
  • No cross-shard joins or transactionsMất join và transaction xuyên shard
  • Changing the shard key ≈ rewriteĐổi khoá shard gần như viết lại

Tell-tale signDấu hiệu nhận biết The primary DB is maxed even with replicas.DB primary chạm trần dù đã có replica.

B3

TAO + memcacheTAO + memcache

the social graph, cachedđồ thị xã hội có cache

Trades immediate consistency for read speed at billion scale.Đổi tính nhất quán tức thì lấy tốc độ đọc ở quy mô hàng tỷ.

Objects and associations (follows, likes, who sees what) served from regional caches over MySQL.Object và association (follow, like, ai xem được gì) phục vụ từ cache theo vùng, MySQL bên dưới.

Use forDùng cho
  • Follows, blocks, mutualsFollow, block, bạn chung
  • Visibility checks on every screenKiểm quyền xem trên mọi màn hình
You gainĐược
  • Billions of reads/s at low latencyHàng tỷ lượt đọc/giây, độ trễ thấp
  • Simple API hides shardingAPI đơn giản che sharding
You loseMất
  • Eventual consistency across regionsNhất quán cuối giữa các vùng
  • Needs a dedicated teamCần một đội vận hành riêng

Tell-tale signDấu hiệu nhận biết You keep asking “does A relate to B?”.Câu hỏi lặp lại: “A có quan hệ X với B không?”.

MediaMedia

M1

EverstoreEverstore

the blob storekho blob

Trades operational effort for a lower cost per byte than renting.Đổi công sức vận hành lấy chi phí trên mỗi byte thấp hơn đi thuê.

Immutable photo and video blobs: write once, read many. Successor to Haystack (2010) and f4 (2014).Ảnh và video lưu dạng blob bất biến: ghi một lần, đọc nhiều lần. Kế thừa Haystack (2010) và f4 (2014).

Use forDùng cho
  • User uploadsẢnh, video người dùng tải lên
  • Cost tiering by hotnessPhân tầng chi phí theo độ nóng
You gainĐược
  • ~1 disk op per read (Haystack)~1 thao tác đĩa mỗi lần đọc (Haystack)
  • Warm tier cuts replication 3.6→2.1 (f4)Tầng ấm hạ nhân bản 3,6→2,1 (f4)
You loseMất
  • Only worth it at huge scaleChỉ đáng ở quy mô cực lớn
  • True deletion is hardXoá thật rất khó

Tell-tale signDấu hiệu nhận biết Storage is your biggest bill.Lưu trữ là hoá đơn lớn nhất.

M2

TectonicTectonic

exabyte filesystem underneathfilesystem exabyte bên dưới

Trades isolation between teams for hardware utilization.Đổi sự cô lập giữa các đội lấy hiệu suất phần cứng.

One multi-tenant filesystem per data center (FAST 2021), with metadata scaled separately from data.Một filesystem đa tenant cho mỗi data center (FAST 2021), metadata mở rộng riêng, tách khỏi dữ liệu.

Use forDùng cho
  • Consolidating storage clustersHợp nhất nhiều cụm lưu trữ
  • Beyond HDFS metadata limitsVượt giới hạn metadata của HDFS
You gainĐược
  • Pools idle capacityGộp công suất nhàn rỗi
  • One system to runMột hệ thống để vận hành
You loseMất
  • Pays off only at Meta scaleChỉ đáng ở quy mô Meta
  • Noisy tenants affect othersTenant ồn ảnh hưởng tenant khác

Tell-tale signDấu hiệu nhận biết Every team runs its own over-provisioned cluster.Mỗi đội chạy một cụm riêng, đều dư công suất.

M3

Creation toolsCông cụ sáng tạo

on the phone; server still transcodestrên máy; server vẫn transcode

Trades consistent output across devices for zero server cost and instant feedback.Đổi sự đồng nhất giữa thiết bị lấy chi phí server bằng không và phản hồi tức thì.

Filters, effects and editing run on the device GPU. Transcoding and moderation still run on servers.Filter, hiệu ứng, chỉnh sửa chạy bằng GPU trên máy. Transcode và kiểm duyệt vẫn chạy ở server.

Use forDùng cho
  • Effects needing instant previewHiệu ứng cần xem trước tức thì
  • Smaller uploads on mobileGiảm dung lượng upload
You gainĐược
  • Zero server GPU per editKhông tốn GPU server mỗi lần chỉnh
  • Drafts never leave the phoneBản nháp không rời máy
You loseMất
  • Slow on old phonesChậm trên máy cũ
  • Output varies by deviceKết quả khác nhau theo máy

Tell-tale signDấu hiệu nhận biết Users drag, rotate and tweak constantly.Người dùng kéo, xoay, chỉnh liên tục.

RankingRanking

The only real sequence on the page: R1 → R2 → R3 are stages of one funnel.Chuỗi có thứ tự duy nhất trên trang: R1 → R2 → R3 là các tầng của cùng một phễu.

R1

RetrievalRetrieval

two-tower modelmô hình two-tower

Trades scoring accuracy for scanning millions of items in milliseconds.Đổi độ chính xác chấm điểm lấy khả năng duyệt hàng triệu mục trong vài mili giây.

User and content become vectors; an ANN index pulls the nearest few thousand from millions in milliseconds.Người dùng và nội dung thành vector; index ANN lấy vài nghìn ứng viên gần nhất từ hàng triệu trong vài ms.

Use forDùng cho
  • Explore, Reels, who-to-followExplore, Reels, gợi ý follow
  • Semantic searchTìm kiếm ngữ nghĩa
You gainĐược
  • Millions → thousands in msHàng triệu → hàng nghìn trong vài ms
  • Content vectors precomputedVector nội dung tính sẵn
You loseMất
  • No user×item cross featuresKhông có đặc trưng chéo người×nội dung
  • Cold start for new itemsNội dung mới khó được chọn

Tell-tale signDấu hiệu nhận biết The candidate pool is in the millions.Kho ứng viên lên tới hàng triệu.

R2

Two-stage rankRanking hai tầng

cheap pass, then expensivelọc rẻ, rồi chấm đắt

Trades the simplicity of one model for an expensive model inside a latency budget.Đổi sự đơn giản của một mô hình lấy khả năng chạy mô hình đắt trong ngân sách độ trễ.

A light model cuts thousands to hundreds; a heavy multi-task model predicts like, save, watch, skip.Mô hình nhẹ cắt hàng nghìn xuống hàng trăm; mô hình nặng đa nhiệm dự đoán like, lưu, xem hết, bỏ qua.

Use forDùng cho
  • Feeds, Reels, adsFeed, Reels, quảng cáo
  • Tight p99 budgetsNgân sách p99 chặt
You gainĐược
  • Expensive compute where it mattersDồn tính toán đắt vào chỗ đáng
  • Clear cost per requestKiểm soát chi phí mỗi request
You loseMất
  • Light stage errors are finalTầng nhẹ loại sai là mất luôn
  • Train/serve skewLệch đặc trưng train/serve

Tell-tale signDấu hiệu nhận biết Your best model is too costly for every candidate.Mô hình tốt nhất quá đắt để chạy trên mọi ứng viên.

R3

Final rerankRerank cuối

diversity + integrity rulesluật đa dạng + an toàn

Trades some short-term engagement for controlled diversity and safety.Đổi một phần tương tác ngắn hạn lấy sự đa dạng và an toàn có kiểm soát.

Business rules on the ranked list: no author floods the screen, formats mix, violating content drops.Luật nghiệp vụ trên danh sách đã xếp: không tác giả nào chiếm màn hình, trộn định dạng, loại nội dung vi phạm.

Use forDùng cho
  • Feeds that repeat themselvesFeed bị lặp
  • Policy enforcementThực thi chính sách cộng đồng
You gainĐược
  • Fix behavior without retrainingSửa hành vi không cần huấn luyện lại
  • Auditable rulesLuật dễ kiểm toán
You loseMất
  • Rules tangle over yearsLuật chồng chéo theo năm
  • Can cancel model gainsCó thể triệt tiêu cải tiến mô hình

Tell-tale signDấu hiệu nhận biết Users say “it’s all the same”.Người dùng than “toàn một kiểu”.

Delivery & operationsTruyền tải & vận hành

D1

QUIC / HTTP/3QUIC / HTTP/3

fewer round tripsít round trip hơn

Trades server CPU and debuggability for lower latency on bad networks.Đổi CPU server và độ dễ gỡ lỗi lấy độ trễ thấp trên mạng xấu.

UDP transport with TLS built in; independent streams and connection IDs that survive Wi-Fi→4G switches.Giao thức trên UDP có sẵn TLS; các luồng độc lập, connection ID giữ kết nối khi đổi Wi-Fi sang 4G.

Use forDùng cho
  • Flaky mobile networksMạng di động chập chờn
  • Users on the moveNgười dùng di chuyển nhiều
You gainĐược
  • No head-of-line blockingHết head-of-line blocking
  • Meta (2020): ~6% fewer errors, ~20% lower tail latencyMeta (2020): giảm ~6% lỗi, ~20% độ trễ đuôi
You loseMất
  • UDP blocked on some networksMột số mạng chặn UDP
  • More server CPU, harder debuggingTốn CPU server, khó gỡ lỗi hơn

Tell-tale signDấu hiệu nhận biết Timeouts spike in weak-network markets.Timeout tăng vọt ở thị trường mạng yếu.

D2

MobileConfigMobileConfig

kill a feature, no new buildtắt tính năng, không build mới

Trades the complexity of many code paths for control over installed apps.Đổi độ phức tạp của nhiều nhánh code lấy quyền điều khiển app đã cài.

Server-controlled values read by the app at runtime: rollouts, A/B tests, kill switches. Only toggles code already shipped.Giá trị do server quyết, app đọc lúc chạy: rollout, A/B test, kill switch. Chỉ bật/tắt code đã có trong app.

Use forDùng cho
  • Instant kill switchTắt tính năng ngay lập tức
  • Gradual rolloutsRollout dần
You gainĐược
  • Minutes, not days, to reactPhản ứng trong vài phút, không phải vài ngày
  • Deploy ≠ releaseTách triển khai khỏi phát hành
You loseMất
  • Flag debt piles upNợ flag tích tụ
  • Bad config spreads just as fastConfig sai lan nhanh không kém

Tell-tale signDấu hiệu nhận biết You can’t wait for app-store review.Không thể chờ app store duyệt bản sửa.

D3

Async queueAsync queue

historically Celery + RabbitMQlịch sử: Celery + RabbitMQ

Trades immediacy and simplicity for low request latency and spike tolerance.Đổi tính tức thì và đơn giản lấy độ trễ request thấp và khả năng chịu đột biến.

Requests record the work; workers do it later. Celery + RabbitMQ is the documented early stack, not confirmed today.Request chỉ ghi lại việc, worker làm sau. Celery + RabbitMQ là stack giai đoạn đầu, chưa xác nhận còn dùng.

Use forDùng cho
  • Fan-out to followersFan-out tới follower
  • Notifications, media processingThông báo, xử lý media
You gainĐược
  • Fast requestsRequest trả về nhanh
  • Absorbs spikes, retries failuresHấp thụ đột biến, tự retry
You loseMất
  • Eventual consistencyNhất quán cuối
  • Jobs may run twiceJob có thể chạy hai lần

Tell-tale signDấu hiệu nhận biết One action triggers thousands of writes.Một hành động sinh ra hàng nghìn lần ghi.

Trade-off tableBảng đánh đổi

The axes that actually decide adoption: when you need it, what it costs to run, what you give up, and the cheaper option.Các trục thật sự quyết định có dùng hay không: khi nào cần, tốn bao nhiêu để vận hành, mất gì, và phương án rẻ hơn.

ConceptKhái niệmNeeded whenCần khiOps costChi phí vận hànhYou give upHy sinhCheaper optionThay thế rẻ hơn
C1Native appsApp nativeCore feature touches hardwareTính năng chính đụng phần cứngHighCaoFeature velocityTốc độ ra tính năngPWA, React NativePWA, React Native
C2WebWebDesktop or SEO neededCần desktop hoặc SEOMediumTrung bìnhHardware accessPhần cứngServer-rendered HTMLHTML render server
C3GraphQLGraphQLScreens hit 4+ APIsMàn hình gọi 4+ APIMediumTrung bìnhHTTP cachingCache HTTPREST BFFBFF REST
B1Django monolithDjango monolithAlmost alwaysGần như luôn luônLow → mediumThấp → trung bìnhIndependent deploysTriển khai độc lậpThis is the baselineĐây là baseline
B2Postgres + CassandraPostgres + CassandraPrimary DB hits write ceilingDB primary chạm trần ghiHighCaoJoins, transactionsJoin, transactionReplicas, bigger boxReplica, máy lớn hơn
B3TAO + memcacheTAO + memcacheBillions of graph reads/sHàng tỷ lượt đọc đồ thị/giâyVery highRất caoImmediate consistencyNhất quán tức thìEdges table + RedisBảng edges + Redis
M1EverstoreEverstoreHundreds of PBHàng trăm PBVery highRất caoInfra team effortCông sức đội hạ tầngS3/R2 + CDNS3/R2 + CDN
M2TectonicTectonicExabytes, many tenantsExabyte, nhiều tenantExtremeCực caoTeam isolationCô lập giữa độiCloud object storageObject storage cloud
M3Creation toolsCông cụ sáng tạoReal-time effectsHiệu ứng thời gian thựcLow (server)Thấp (server)Consistent outputĐồng nhất kết quảServer-side processingXử lý ở server
R1RetrievalRetrievalMillions of candidatesHàng triệu ứng viênHighCaoAccuracyĐộ chính xácSQL filters, heuristicsLọc SQL, heuristic
R2Two-stage rankRanking hai tầngBest model too costlyMô hình tốt quá đắtHighCaoSimplicitySự đơn giảnOne modelMột mô hình
R3Final rerankRerank cuốiFeed repeats or risks harmFeed lặp hoặc có rủi roLowThấpShort-term scoreĐiểm ngắn hạnNo rerankKhông rerank
D1QUIC / HTTP/3QUIC / HTTP/3Bad mobile networksMạng di động xấuLow via CDNThấp nếu qua CDNCPU, debuggabilityCPU, độ dễ gỡ lỗiTCP + TLS 1.3TCP + TLS 1.3
D2MobileConfigMobileConfigA shipped mobile appApp mobile đã phát hànhLowThấpCode pathsNhánh codeForced upgradeÉp cập nhật
D3Async queueAsync queueSlow work inside requestsViệc chậm trong requestLow → mediumThấp → trung bìnhImmediacyTính tức thìJob table in PostgresBảng job trong Postgres

Anti-patternsAnti-patterns

MistakeSai lầmWhy it’s wrongVì sao saiFixSửa thế nào
Microservices from day one “because Netflix does it”Tách microservices từ ngày đầu “vì Netflix làm vậy”Network latency, distributed failure and ops cost before there is a problemThêm độ trễ mạng, lỗi phân tán, chi phí vận hành khi chưa có vấn đềModular monolith; split on a measured reasonModular monolith; tách khi có lý do đo được
Reading this chart as “a monolith scales to anything”Đọc ảnh này thành “monolith mở rộng được tới mọi quy mô”Instagram scales because it stands on Meta’s infrastructureInstagram mở rộng được vì đứng trên hạ tầng MetaMonolith for product logic, managed services for storage, cache, queuesMonolith cho logic sản phẩm, dịch vụ quản lý sẵn cho lưu trữ, cache, queue
Sharding before tuning queries and indexesShard trước khi tối ưu truy vấn và indexSharding is effectively irreversibleSharding gần như không đảo ngược đượcIndexes, cache, replicas, a bigger box — then shardIndex, cache, replica, máy lớn hơn — rồi mới shard
Cassandra for data that needs joinsDùng Cassandra cho dữ liệu cần joinNo joins; you rebuild them in app codeKhông có join, phải tự ghép ở appKeep it in Postgres; Cassandra for key lookupsGiữ ở Postgres; Cassandra cho truy vấn theo khoá
Building your own blob storeTự xây kho blobYears of engineering to end up worse than S3Tốn nhiều năm kỹ sư để kém S3Object storage + CDN + lifecycle rulesObject storage + CDN + lifecycle
GraphQL without batched resolversGraphQL không batch resolverN+1 queries overload the databaseN+1 query làm quá tải DBDataLoader and query-cost limitsDataLoader và giới hạn chi phí query
ML ranking with no interaction dataRanking ML khi chưa có dữ liệu tương tácThe model learns from nothingMô hình không có gì để họcTime order + heuristics; log interactions firstSắp theo thời gian + heuristic; ghi log tương tác trước
Feature flags that never dieFeature flag không bao giờ gỡDead branches and untested combinationsNhánh chết và tổ hợp chưa kiểm thửOwner and expiry date per flagMỗi flag có người chịu trách nhiệm và ngày hết hạn
Non-idempotent async jobsJob async không idempotentRetries create duplicate dataRetry tạo dữ liệu trùngIdempotency keys, upsertsKhoá idempotency, upsert

What the chart gets wrongẢnh gốc sai ở đâu

The chart saysẢnh nóiWhat is actually knownThực tế
“Not microservices. One big Django app.”“Not microservices. One big Django app.”True for product code only. TAO, the blob store, Tectonic and ranking are separate Meta services.Chỉ đúng với code sản phẩm. TAO, kho blob, Tectonic, ranking là service riêng của Meta.
“Missing from the chart: Postgres + Cassandra, Celery”“Missing from the chart: Postgres + Cassandra, Celery”Self-contradictory — all three are in the chart. Ignore it.Tự mâu thuẫn — cả ba đều có trong ảnh. Bỏ qua.
“Python”“Python”Python 3 on Cinder, Meta’s CPython fork with a JIT (open source since 2021).Python 3 trên Cinder, bản fork CPython có JIT của Meta (mã nguồn mở từ 2021).
“Celery + RabbitMQ”“Celery + RabbitMQ”Documented for 2012–2013 (Gearman before). Not confirmed as today’s queue.Có tài liệu giai đoạn 2012–2013 (trước đó là Gearman). Chưa xác nhận còn dùng hôm nay.
“Postgres + Cassandra”“Postgres + Cassandra”Public for 2012–2018. After the move into Meta data centers, the current mix isn’t public.Công khai giai đoạn 2012–2018. Sau khi dời vào data center Meta, tỷ lệ hiện tại không công khai.
“Creation tools run on the phone, not the server”“Creation tools run on the phone, not the server”Editing does. Transcoding, thumbnails and moderation still run on servers.Phần chỉnh sửa thì đúng. Transcode, thumbnail, kiểm duyệt vẫn ở server.
“Haystack was the 2010 version”“Haystack was the 2010 version”Correct, but skips f4 (2014) for warm data before Tectonic (2021).Đúng, nhưng bỏ sót f4 (2014) cho dữ liệu ấm trước Tectonic (2021).

Three things to rememberBa câu cần nhớ

Monolith at the product layer, platform services at the infrastructure layer. Copy both halves.Monolith ở tầng sản phẩm, platform services ở tầng hạ tầng. Chép cả hai nửa.

Every system here answers a measured bottleneck. No bottleneck, the baseline wins.Mọi hệ thống ở đây là lời giải cho một nút thắt đo được. Chưa có nút thắt thì baseline thắng.

If you can’t say what a choice costs you, you’re not ready to make it.Nếu chưa nói được lựa chọn khiến mình mất gì, bạn chưa sẵn sàng chọn.