Tales of Performance Engineering
Article Summary
Diego Parra from Mercado Libre's Performance Engineering team just shared how they slashed API response times by 60% with one strategic fix. The culprit? Regex compilations eating 40% of CPU cycles.
Mercado Libre introduced their new Performance Engineering team and detailed a real-world optimization of a critical payments API. Using continuous profiling and flame graphs, they identified that repeated regex compilations were crushing performance and memory allocation.
Key Takeaways
- P95 response times dropped 60%, from 66.7ms to 25.68ms
- Client timeout errors (499s) plummeted 98%, from 1.12M to 31K
- Instance count reduced 60% (318 to 125) by caching compiled regex
- Continuous profiling revealed 73% of memory allocations tied to regex
- Performance Engineering works with SRE and Observability as operational backbone
A simple caching strategy for compiled regex patterns delivered massive gains: 60% faster responses, 98% fewer errors, and 60% fewer instances needed.
About This Article
A Go API in Mercado Libre's payments platform was using too much CPU and memory. Garbage collection was eating up 11.2% of CPU cycles because of how the code allocated memory.
Diego Parra's Performance Engineering team started caching regex patterns with Go's ccache library. This stopped the code from compiling the same patterns over and over, which had been taking 40% of CPU and 73% of memory allocations.
Response times dropped from 231.94ms to 76.52ms at the high end. Garbage collection CPU usage fell from 11.2% to 6.7%, which is about a 40% improvement in how efficiently the garbage collector runs.