Bird
0
0

To minimize the time needed to rebuild state from Kafka events in event sourcing, which technique is most effective?

hard📝 Application Q8 of 15
Kafka - Event-Driven Architecture
To minimize the time needed to rebuild state from Kafka events in event sourcing, which technique is most effective?
AIncreasing the Kafka topic retention time indefinitely
BPeriodically creating snapshots of the current state to avoid full event replay
CFiltering out events that do not change the state
DUsing multiple consumers to replay the same events concurrently
Step-by-Step Solution
Solution:
  1. Step 1: Identify replay bottleneck

    Replaying all events from the beginning can be slow as event count grows.
  2. Step 2: Use snapshots

    Snapshots capture the current state at intervals, reducing replay to events after the snapshot.
  3. Step 3: Evaluate other options

    Increasing retention doesn't reduce replay time; filtering events risks losing data; concurrent replay causes conflicts.
  4. Final Answer:

    Periodically creating snapshots of the current state to avoid full event replay -> Option B
  5. Quick Check:

    Snapshots speed up state rebuild by limiting replay [OK]
Quick Trick: Use snapshots to reduce replay time [OK]
Common Mistakes:
MISTAKES
  • Assuming longer retention reduces replay time
  • Filtering events can cause inconsistent state
  • Concurrent replay leads to race conditions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes