Author: Aivars Kalvāns


How I made `json.dumps` ~20% faster

This post was first published in   My journey to understand the performance and concurrency of FastAPI services lead me to the Python json.dumps function producing JSON string out of object tree. And I ended up making it a bit faster. _PyAccu vs _PyUnicodeWriter How do you create the JSON...

August 30, 2022

FastAPI and cooperative multi-threading

This post was first published in Cal Paterson wrote a great article comparing and describing synchronous and asynchronous Python frameworks and explaining why asynchronous frameworks go a bit wobbly under load. This is a story of how we experienced wobbliness in a recent project. We are using FastAPI, Pydantic, and...

February 10, 2022

Optimizing Kafka producers for latency

This post was first published in The code I am working with uses Confluent Kafka Python library that calls librdkafka C++ library underneath. The code does synchronous messaging: it produces events one-by-one and ensures event is persisted in Kafka topic by waiting for acknowledgments from all replicas. This code is sensitive to latency...

January 28, 2022