Agoda

House of Coroutines: How we Debugged 3M Unbounded Coroutines in Agoda’s Kotlin Service

Apr 29, 2026Agoda Engineering
House of Coroutines: How we Debugged 3M Unbounded Coroutines in Agoda’s Kotlin Service
SummaryAI, from the source post

This post details the technical implementation of fixes for three distinct issues in Agoda's review-api Kotlin service: 1. Unnecessary deserialization on every request for warmup cache entries, resolved by storing the map directly in memory. 2. Unbounded coroutines causing CPU and memory spikes, addressed by moving CPU-bound serialization work off the IO dispatcher and transitioning to the Redis client's future API for bounded background operations. 3. A thread-safety bug in Koin's ScopedInstanceFactory, worked around by shadowing the upstream class and later resolved by upgrading the ag-bootstrap framework.