Which protocol guarantees cross-shard consistency but is slow and fragile, leading most production systems to avoid it?

Test your Systems Design Concepts knowledge with our comprehensive quiz. Utilize flashcards and multiple choice questions to enhance your study session. Prepare thoroughly with detailed explanations for each answer and ace your examination!

Multiple Choice

Which protocol guarantees cross-shard consistency but is slow and fragile, leading most production systems to avoid it?

Explanation:
Cross-shard consistency with multiple databases is achieved by coordinating a single atomic transaction across all shards. The Two-Phase Commit protocol does exactly that: in the first phase, every shard votes whether it can commit; in the second phase, the coordinator tells everyone to commit or to abort based on the votes. This guarantees that either all shards commit or none do, preserving strict consistency across shards. But this comes at a cost. Because the coordinator must wait for all participants and each shard must write durable logs and respond, the process is slow, with multiple round-trips and disk I/O. If any participant or the coordinator fails, the system can enter a blocked state while recovery proceeds, making the setup fragile and less resilient to failures. That combination of low performance and fragility is why most production systems avoid 2PC for cross-shard transactions. In practice, many systems prefer patterns like Saga, which use a sequence of local transactions with compensating actions to achieve eventual consistency, trading strict cross-shard atomicity for better availability and throughput. The other options relate to partitioning or bottlenecks rather than ensuring global transactional consistency across shards.

Cross-shard consistency with multiple databases is achieved by coordinating a single atomic transaction across all shards. The Two-Phase Commit protocol does exactly that: in the first phase, every shard votes whether it can commit; in the second phase, the coordinator tells everyone to commit or to abort based on the votes. This guarantees that either all shards commit or none do, preserving strict consistency across shards.

But this comes at a cost. Because the coordinator must wait for all participants and each shard must write durable logs and respond, the process is slow, with multiple round-trips and disk I/O. If any participant or the coordinator fails, the system can enter a blocked state while recovery proceeds, making the setup fragile and less resilient to failures. That combination of low performance and fragility is why most production systems avoid 2PC for cross-shard transactions.

In practice, many systems prefer patterns like Saga, which use a sequence of local transactions with compensating actions to achieve eventual consistency, trading strict cross-shard atomicity for better availability and throughput. The other options relate to partitioning or bottlenecks rather than ensuring global transactional consistency across shards.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy