Python on Serverless: Strategies for Peak Performance - Alejandro Cabello JimƩnez
[EuroPython 2026 - S4 on 2026-07-16] š¤ *Python on Serverless: Strategies for Peak Performance by Alejandro Cabello JimĆ©nez* š https://ep2026.europython.eu/session/python-on-serverless-strategies-for-peak-performance š Abstract: We deployed Python in serverless environments and quickly saw the performance limits. Serverless systems suffer from startup latency, memory overhead, and repeated object creation as their executions start almost from scratch. Those extra seconds made our user experience painfully slowāand we couldnāt afford it. We looked into the performance of our flight search engine, ran profilers, and applied optimizations. We found real gains when *tuning Pythonās GC,* reducing *stop-the-world pauses,* and introducing an *asynchronous post-execution process* that runs after the handler returns. We reduced execution time from *1.2 seconds to 300 millisecondsāa 4Ć speedup* with just a few tweaks. Understanding *Pythonās memory model* and its runtime behavior was essential, and itās something weāll dive into during the talk. What we share is based on *AWS Lambda,* but it can be applied to any short-lived Python systemāwhether serverless or containerized. Another big gain came from replacing `Pydantic` with `TypedDict` for faster parsing, using *Redis* strategically to distribute operations, and restructuring code to eliminate duplicated transformations. Our web API processes thousands of flight offersādeserialize, enrich, transformāand every millisecond counts. While covering optimization techniques, when they matter, and how we measured their impact, the main idea is that you will walk away with tactics that help your system stay fast while it grows. --- This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License: https://creativecommons.org/licenses/by-nc-sa/4.0/