
foojay · 5 min readBackend & APIs
One character at a time: a 7× regression in DHIS2
The article dissects a 7× performance regression in DHIS2’s dataValueSets API, pinpointing a serialization flaw in json-tree that caused per‑character flushing. It explains how targeted measurements revealed the culprit and how a library upgrade restored speed. The findings illustrate the value of systematic benchmarking and quick regression isolation.
- json-tree’s PrintStream.append caused 250M sync flushes, inflating JSON export time.
- Gzip compression worsened performance because the writer streamed one byte at a time.
- Upgrading to json-tree 1.9.4 eliminated the per‑character bottleneck, restoring JSON speed.