PyCon DE & PyData 2025

Rustifying Python: A Practical Guide to Achieving High Performance While Maintaining Observability
2025-04-25 , Titanium3

In this session, I’ll share our journey of migrating key parts of a Python application to Rust, resulting in over 200% performance improvement.
Rather than focusing on quick Rust-to-Python integration with PyO3, this talk dives into the complexities of implementing such a migration in an enterprise environment, where reliability, scalability, and observability are crucial.
You’ll learn from our mistakes, how we identified suitable areas for Rust integration, and how we extended our observability tools to cover Rust components.
This session offers practical insights for improving performance and reliability in Python applications using Rust.


For performance-critical sections of code, especially those that are I/O-bound or CPU-heavy, Python’s Global Interpreter Lock (GIL) can create significant bottlenecks.
To improve performance, our team explored integrating Rust, taking advantage of its speed and concurrency features while maintaining Python’s ease of use and flexibility.

This session will focus on overcoming common hurdles when migrating to Rust and optimizing performance in a real-world, production environment which orchestrates workload across 2000 compute nodes in various data centers and cloud provider regions.
This talk covers practical aspects such as observability, scalability, and deployment in a production setting.

We’ll begin by discussing how to identify the parts of your Python code that would benefit most from a Rust migration, particularly those where the GIL is a limiting factor.
We’ll also share insights into our migration process, including the challenges we faced and how we overcame them.
You’ll learn how we refactored Python code and used PyO3 to integrate Rust, achieving over 200% performance improvements.

A key challenge when adding Rust to a Python codebase is maintaining robust observability.
We’ll explain how we extended our OpenTelemetry and Sentry observability stack to include Rust components, ensuring seamless monitoring, tracing, and debugging across the entire stack.

Throughout the session, we’ll illustrate the process with a practical example: a simplified version of our own application, which includes both I/O-heavy and compute-heavy tasks.
You’ll see how to break down business logic and decide which parts to migrate to Rust for maximum performance benefit.

By the end of this session, you will be equipped with the knowledge to assess where Rust can improve your Python application’s performance, and how to integrate it in a reliable and observable way.
This session is ideal for anyone looking to optimize Python performance with Rust, while keeping applications running.


Expected audience expertise: Domain:

Intermediate

Expected audience expertise: Python:

Intermediate

I’m a Senior Software Developer in the team behind SAP’s huge CI/CD infrastructure for SAP HANA.
We design, implement, operate and maintain it's cloud native graph-based task execution framework leveraging 2000 compute nodes in multiple data centers and cloud provider regions.
In my spare time, I like to play Dungeons & Dragons.