Wiki: Event Sourcing Scaling - Pay Less, Do More
For agents: Markdown version · Wiki index · Explore
- Speaker: Michael Feinstein
- Event: Reversim Summit 2018
- Video: https://www.youtube.com/watch?v=p0oe2BPl6zw
- Transcript: /transcripts/2018/31-p0oe2BPl6zw.md
- Language: English · Type: talk · Level: intermediate
- Topics: Scalability, Cloud Computing, Distributed Systems, Databases
Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.
Summary
The speaker shares how an infrastructure team improved the efficiency, performance, and cost-effectiveness of an event-driven microservices architecture under extreme load. By replacing standard queue-depth metrics with a combined metric of queued and in-progress messages, and by measuring and scaling more frequently, the team eliminated latency peaks. They also introduced worker locking during message processing to prevent dead-letter loops and maintained a cloud provider fallback for high availability. Ultimately, the audience learns practical strategies for optimizing cloud costs and auto-scaling reliability in event-sourcing systems.
Key points
- 0:12 The infrastructure team balances simplicity, customer SLAs, and financial costs across a microservices architecture.
- 5:17 The system relies on an asynchronous, event-based backend where services communicate entirely through published messages and queues.
- 11:30 Standard cloud provider auto-scaling based solely on queue depth is reactive and leads to delayed responses and wasted compute instances.
- 13:33 A better scaling metric combines the number of queued messages with messages currently in progress plus idle compute spares.
- 18:37 Scaling in workers randomly can terminate instances that are actively processing messages, returning them to the queue and artificially inflating demand.
- 19:37 Implementing a worker-locking mechanism ensures that only idle instances are terminated during scale-in operations.
- 24:39 Retaining the cloud provider’s native auto-scaling mechanism as a fallback ensures system resilience if the custom scaling service fails.
Takeaways
- Base auto-scaling decisions on a combination of queue depth and active in-progress tasks rather than queue depth alone.
- Lock workers that are actively processing messages to prevent them from being terminated and re-queuing unfinished work.
- Maintain a simpler out-of-the-box cloud scaling mechanism as a reliable fallback for your custom scaling logic.
Questions this talk answers
- How can you avoid the latency and cost penalties of reactive queue-based auto-scaling?
- What causes phantom demand spikes when scaling in an event-driven worker pool?
- How do you build a safe fallback mechanism when implementing custom auto-scaling logic?
Technologies
AWS Lambda, EC2, PagerDuty
Tags
auto scaling, cloud costs, distributed systems, event sourcing, infrastructure, microservices, monitoring