Wiki: Throttling your service: the good, the bad and the ugly
For agents: Markdown version · Wiki index · Explore
- Speaker: Yonatan Zusman
- Event: Reversim Summit 2024
- Video: https://www.youtube.com/watch?v=teloyUxPAyc
- Transcript: /transcripts/2024/24-teloyUxPAyc.md
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: Scalability, Performance, Networking, Debugging
Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.
Summary
The speaker discusses how to handle unexpected production load and extreme traffic spikes by implementing an automated throttling mechanism instead of letting the system crash. By using request latency as a proxy for system load, the service can dynamically adjust the depth of work it performs per request, such as returning fewer recommendations. The speaker explains the implementation, the business impact trade-offs, and the unexpected challenges that arose during production testing and optimizations. Ultimately, listeners learn how graceful degradation protects system stability while preserving business metrics as much as possible.
Key points
- 0:13 Systems are usually designed for a target load plus a safety margin, but extreme traffic spikes will eventually happen and cause crashes.
- 4:37 The speaker introduces throttling and load shedding as techniques to handle extreme loads rather than relying solely on cloud elasticity.
- 8:56 Simple rate limiting by randomly dropping requests is too aggressive and directly hurts business revenues.
- 9:57 The system uses request latency as the primary metric for load detection instead of raw traffic volume or CPU usage.
- 11:00 When high load or increased latency is detected, the system dynamically reduces the number of recommendations processed per request.
- 26:02 Weekly load tests in production show that the throttling mechanism reacts within two minutes to traffic spikes.
- 34:46 A control group with unthrottled traffic buckets is maintained to continuously measure the business impact and revenue trade-offs.
- 55:41 Fast-failing errors can artificially lower average latency, tricking the throttle into increasing load and triggering a snow-ball effect.
Takeaways
- Use request latency instead of raw traffic volume or CPU utilization as an indicator for system load and throttling decisions.
- Implement graceful degradation by shedding non-essential work dynamically rather than rejecting requests completely.
- Measure the business impact of your throttling mechanisms by running control groups that bypass the throttle for a small percentage of traffic.
Questions this talk answers
- How can you detect system load without relying solely on CPU utilization or incoming traffic counts?
- What is the best way to prevent throttling mechanisms from conflicting with application errors or code optimizations?
- How do you measure the business impact and revenue loss caused by shedding load during traffic spikes?
Technologies
Kafka, RabbitMQ
Tags
graceful degradation, latency, load balancing, production incidents, resilience, throttling