0
0
HLDsystem_design~10 mins

Cross-shard queries in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the component responsible for routing queries to the correct shard.

HLD
The [1] directs queries to the appropriate shard based on the shard key.
Drag options to blanks, or click blank then click option'
AQuery Router
BData Node
CLoad Balancer
DCache Layer
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the Data Node with the Query Router.
Thinking the Load Balancer handles query routing.
2fill in blank
medium

Complete the code to describe the step where data is aggregated from multiple shards.

HLD
After querying individual shards, the [1] combines the results into a single response.
Drag options to blanks, or click blank then click option'
AShard Manager
BAggregator
CQuery Router
DCache Layer
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the Aggregator with the Query Router.
Assuming the Cache Layer does aggregation.
3fill in blank
hard

Fix the error in the description of cross-shard query latency.

HLD
Cross-shard queries often have higher latency due to [1] across shards.
Drag options to blanks, or click blank then click option'
Asingle-thread processing
Blocal caching
Cnetwork communication
Ddisk I/O
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing disk I/O which affects all queries, not specifically cross-shard.
Selecting local caching which reduces latency.
4fill in blank
hard

Fill both blanks to complete the description of a common strategy to reduce cross-shard query overhead.

HLD
To reduce overhead, systems often [1] queries to shards and [2] results before sending to the client.
Drag options to blanks, or click blank then click option'
Aparallelize
Bcache
Caggregate
Dserialize
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up serialization with aggregation.
Thinking caching happens before querying.
5fill in blank
hard

Fill all three blanks to complete the explanation of handling consistency in cross-shard queries.

HLD
To maintain consistency, the system uses [1] to coordinate shards, [2] to lock data, and [3] to resolve conflicts.
Drag options to blanks, or click blank then click option'
Adistributed transactions
Btwo-phase commit
Cconflict resolution
Deventual consistency
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing eventual consistency with locking.
Mixing up conflict resolution with transaction coordination.