Bird
Raised Fist0
HLDsystem_design~20 mins

Event sourcing in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Event Sourcing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary benefit of using event sourcing in a system?

Consider a system that records all changes as events instead of just storing the current state. What is the main advantage of this approach?

AIt allows rebuilding the current state by replaying all past events.
BIt reduces the total number of database writes by storing only the latest state.
CIt eliminates the need for backups since events are immutable.
DIt automatically encrypts all data for security.
Attempts:
2 left
💡 Hint

Think about how you can recover or understand the system state at any point in time.

Architecture
intermediate
2:00remaining
Which component is essential in an event sourcing architecture to reconstruct the current state?

In an event sourcing system, which component is responsible for rebuilding the current state from stored events?

AEvent Store
BAPI Gateway
CEvent Processor (or Event Replay Engine)
DCommand Handler
Attempts:
2 left
💡 Hint

Think about the part that reads events and applies them to get the current state.

scaling
advanced
2:00remaining
How can event sourcing systems handle very large event streams efficiently?

When the number of events grows very large, replaying all events to rebuild state becomes slow. What is a common technique to improve performance?

AUse snapshots to store periodic full states and replay only recent events.
BDelete old events after a fixed time to keep the event store small.
CStore only the latest event and discard previous ones.
DSwitch to a relational database to speed up queries.
Attempts:
2 left
💡 Hint

Think about saving intermediate states to avoid replaying everything from the start.

tradeoff
advanced
2:00remaining
What is a key tradeoff when using event sourcing compared to traditional state storage?

Event sourcing offers benefits but also has downsides. Which of the following is a common tradeoff?

ALoss of historical data due to overwriting events.
BIncreased complexity in rebuilding state and handling event versioning.
CInability to audit changes since only current state is stored.
DReduced fault tolerance because events are mutable.
Attempts:
2 left
💡 Hint

Consider what extra work developers must do when using event sourcing.

estimation
expert
3:00remaining
Estimate the storage growth for an event sourcing system with 1000 events per second over 1 year, assuming each event is 1 KB.

Calculate the approximate storage needed to keep all events for one year if the system generates 1000 events every second and each event is 1 KB in size.

AAbout 315 GB
BAbout 315 TB
CAbout 3.15 TB
DAbout 31.5 TB
Attempts:
2 left
💡 Hint

Calculate total seconds in a year, multiply by events per second and event size.