# From 150,000 OS Threads to C++20 Coroutines: A 1000x Memory Reduction

Original title: A Practical Intuition for C++20 Coroutines

> Hacker News story 49422278 · language: en · submitted 2026-08-24
> Web version: https://zeli.app/story/49422278
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 9 · by [eivanov89](<https://news.ycombinator.com/user?id=eivanov89>) · 💬 3
[original](<https://blog.ydb.tech/making-coroutines-routine-building-a-scalable-tpc-c-client-in-c-b14f55a09471?postPublishedType=repub>) · [HN discussion](<https://news.ycombinator.com/item?id=49422278>)

## Summary

At YDB, benchmarking a distributed database with TPC-C initially required 150,000 OS threads and 600 GiB of RAM, saturating the client before the database. After optimizing Java virtual threads and hitting a deadlock, the team rewrote the client in C++ using futures and then coroutines. The result: 16 worker threads, memory reduced by over 1000x, and a client that keeps up. This post explores the journey, explains coroutine internals, and tackles the key question of which thread executes continuations after a future or coroutine becomes ready.

## Key quote

> OS threads are a good unit of parallel execution. They are a poor unit for representing hundreds of thousands of mostly sleeping workflows.

---

## Cite

- Page: https://zeli.app/story/49422278
- Date: 2026-08-24
- Source: blog.ydb.tech (https://blog.ydb.tech/making-coroutines-routine-building-a-scalable-tpc-c-client-in-c-b14f55a09471?postPublishedType=repub)
- Hacker News: https://news.ycombinator.com/item?id=49422278
