Mistakes and Trade-offs when optimizing the hot-path
summary
Shows how to find and fix the actual hot path: assume word_of_day = 1 rps and word_exists = 20 rps, measure p99s with Gatling and internal timers (metrics endpoint), find load_file p99 ~7 ms but scan p99 ~5 s, and then implement a static lookup cache (using Guava cache). Rebench with JMH and Gatling: word_exists p99 drops to ~65 ms (≈80× faster), system workload share falls from ~99.7% to ~79%, demonstrating measurable, validated tradeoffs.
AI-written summary · about
chapters (31)
- 0:00Intro
- 0:46Mistakes and Trade-offs
- 1:35When Premature Optimisation is evil?
- 3:48Accounts processing logic
- 7:18Hidden complexities
- 7:48Split phase - is it worth it?
- 8:30Benchmark the performance optimization
- 9:58Baseline vs parallel
- 11:37Lessons learned
- 13:46Understanding hot-path in your code
- 18:51The Pareto principle in the context of software systems
- 21:03Configuring number of concurrent users(threads) for a given SLA
- 21:33One-thread scenario
- 22:22Divide stress test traffic to N nodes
- 23:12Multiply by some factor to allocate threads for outliers
- 24:47Service with a potential hot-path
- 25:43WordService interface
- 29:05Detecting the hot-path in your code
- 29:59Getting word of the day performance scenario
- 31:04Words used for performance testing
- 31:41Validate the word performance scenario
- 32:01Setup traffic according to SLA
- 33:33Calculating impact of the hot-path optimisation
- 35:41Measuring code using Metrics
- 36:55load measurements
- 39:20Optimize word-exists using Cache
- 41:10Re-run Gatling tests
- 41:38Recalculate the hot-path
- 42:37The percentage of traffic generated by both endpoints
- 43:47Further improvements (assuming 10%)
- 44:55Check out my book
