Concepts/6. Advanced Concepts/Two-Phase Commit (2PC) Protocol
🤝
6. Advanced ConceptsAdvanced🔒 LOCKED FOR FREE TIER

Two-Phase Commit (2PC) Protocol

← All 150+ Concepts

Coordinates atomic distributed transactions across multiple independent databases using a Prepare phase and a Commit phase orchestrated by a transaction coordinator.

STAFF ENGINEER TAKEAWAY: 2PC is a blocking protocol: if the coordinator crashes during the prepare phase, participating database nodes must hold row locks indefinitely, stalling the entire system.
🔒

Unlock Two-Phase Commit (2PC) Protocol & All 150+ Visual Architecture Deep Dives

This advanced distributed system deep-dive includes interactive packet visualizers, state machine transitions, and FAANG interview trade-off blueprints.

More Topics in 6. Advanced Concepts

🚦Rate Limiting & Traffic Throttling

Controls the rate of incoming network traffic to protect services from abusive traffic, scraping, DDoS attacks, and resource starvation.

🪣Token Bucket Rate Limiting Algorithm

A bucket holds up to B tokens and refills at a constant rate R tokens/sec. Each incoming request consumes 1 token. If no tokens remain, requests are dropped.

💧Leaky Bucket Rate Limiting Algorithm

Requests enter a FIFO queue bucket. The bucket leaks requests out to the backend at a strictly constant smooth rate, smoothing out spiky traffic.

🪟Sliding Window Log & Counter

Tracks request timestamps in a sorted set (Redis ZSET) to compute precise request counts within any rolling 60-second window, eliminating boundary burst bugs.