ClassPass May 17, 2022

Async Jersey + Kotlin Coroutines

Article Summary

ClassPass engineers were hitting a wall: their Jersey-based APIs couldn't handle traffic spikes without exhausting thread pools. The culprit? Synchronous request processing blocking precious I/O threads.

Dan Murphy from ClassPass Engineering shares how they integrated Jersey's async API with Kotlin coroutines to build more resilient backend services. The team had to solve tricky challenges around connection leaks, logging context, and APM instrumentation.

Key Takeaways

Critical Insight

Combining Jersey's async API with Kotlin coroutines made ClassPass services more resilient under load while maintaining observability.

The article includes production-ready code for the submitToCoroutine extension that handles MDC context, New Relic tokens, and error handling automatically.

Recent from ClassPass

Related Articles