1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is a monotonic counter?
A value that only moves upward and never decreases.
Why do distributed systems use monotonic counters?
They provide reliable ordering, detect duplicate events, avoid clock drift issues, and simplify concurrency control.
How do monotonic counters help with idempotency?
By rejecting any operation with a counter value less than or equal to the last processed one.
Why are timestamps unreliable for ordering?
Clocks drift, servers disagree, and network delays cause messages to arrive out of order.
How does a monotonic counter prevent double resets?
It stores a 'last_processed_cycle' value to reject already processed cycles.
What is an example of monotonic counter use in leaderboards?
Using a cycle_id that increments for each leaderboard reset, ignoring submissions for older cycles.
How do monotonic counters help with concurrency?
They resolve write ordering by giving each operation a strictly increasing sequence number.
How do you implement a monotonic counter in Postgres?
With an atomic update: UPDATE counters SET value = value + 1 RETURNING value.
How do you implement monotonic counters in Redis?
Using the atomic INCR command, which guarantees a unique increasing integer per call.
Why use counters for reward claim history?
Each reward claim is assigned an increasing claim_id for easy identification of late or duplicate claims.
How do monotonic counters help with event ordering in games?
They ensure operations are applied in the correct, deterministic order.
What happens if two workers increment a monotonic counter at the same time?
The datastore serializes updates atomically, giving each operation a unique increasing value.
How do monotonic counters support multi-region systems?
Each region may maintain its own counters or use a conflict-free data type.
Why avoid manually incremented counters in distributed systems?
Concurrent writes can collide, causing duplicate IDs or skipped values.
How do monotonic counters help debug race conditions?
They provide a strict ordering timeline of operations.
What is a cycle-based partitioning example using monotonic counters?
Leaderboard cycles where cycle_id increments every interval, rejecting submissions referencing old cycles.