LeetDezine
The first time I heard "optimize for latency," I thought it meant "make it fast." So I turned off batching, flushed writes immediately, set Kafka's linger.ms to 0.
The system responded faster. And handled way less load.
Latency and throughput pull in opposite directions. Making your system faster for individual requests usually means it handles fewer of them per second. Handling more per second usually means individual requests wait longer. This tradeoff shows up everywhere and misidentifying which axis to optimize is one of the most common architecture mistakes.
DB Batch Writes
Your database is getting hammered with writes. Each write goes to disk immediately.
Latency per write: 10ms
One thread handles: 100 writes per second
Change the approach: collect 100 records, flush in one batch.…