Web performance consultant for Python
Optimize web performance on Python applications
Python powers a significant share of web backends (Django, FastAPI, Flask). Its flexibility exposes specific bottlenecks: ORM N+1, blocking synchronous views, miscalibrated gunicorn, GIL saturating. I work on these angles to drop TTFB.
They trust me
Python symptoms calling for an audit
Python web applications show characteristic backend bottlenecks that profiling exposes.
🔁 TTFB drifting on Django listings
N+1 pattern on the ORM: the view loops on N objects and queries their relations one by one. Django Debug Toolbar or django-silk expose the pattern, select_related / prefetch_related fix it.
📊 Non-indexed SQL queries on hot tables
EXPLAIN on slow queries identifies full scans. Adding indexes adapted to the access pattern drops query time 10x to 100x on typical cases.
🐌 Synchronous views blocked on external API calls
A view making a synchronous outbound HTTP call blocks the worker for the entire I/O wait duration. Moving to async (Django 4+ async views, or direct FastAPI) frees the worker.
⚙️ gunicorn or uvicorn miscalibrated
Too few workers → CPU underused. Too many → context-switching that hurts. Calibration based on profile (CPU-bound vs I/O-bound) drops perceived latency.
💾 No cache layer between app and DB
Without Redis or Memcached as global cache, every request hits the DB for rarely-modified data (configurations, taxonomies). A cache layer divides SQL load and drops TTFB.
🐍 Python 3.10 or older without CPython 3.11+
Python 3.11 and 3.12 bring significant performance gains on the interpreter (adaptive specialization). CPython upgrade is among the most cost-effective Python backend gains.
Python optimization methodology
4 steps to transform your performance
1. Django Debug Toolbar or cProfile profiling
Identify N+1, slow queries, blocking views. Map LCP-critical endpoints and their P95.
2. ORM and SQL optimization
N+1 refactor (select_related, prefetch_related), SQL index addition on hot tables, query optimization via EXPLAIN.
3. Async views and caching
Convert blocking views to async (Django 4+, FastAPI), set up global Redis cache (configurations, sessions), cache fragments on listings.
4. gunicorn / uvicorn and CPython
Worker calibration based on profile (CPU-bound vs I/O-bound), CPython 3.11+ upgrade for interpreter gains, continuous monitoring.
1. Django Debug Toolbar or cProfile profiling
Identify N+1, slow queries, blocking views. Map LCP-critical endpoints and their P95.
2. ORM and SQL optimization
N+1 refactor (select_related, prefetch_related), SQL index addition on hot tables, query optimization via EXPLAIN.
3. Async views and caching
Convert blocking views to async (Django 4+, FastAPI), set up global Redis cache (configurations, sessions), cache fragments on listings.
4. gunicorn / uvicorn and CPython
Worker calibration based on profile (CPU-bound vs I/O-bound), CPython 3.11+ upgrade for interpreter gains, continuous monitoring.
Mission commitments
Frequently asked questions
Django vs FastAPI for performance?
Should I move to async?
Is Python intrinsically slow?
How are your Python engagements structured?
Drop your Python TTFB
Data 2023-2026
What my clients say
Excellent work.
Paul has significantly improved the site's speed and perfectly aligned it with Google's recommendations.
Professional, thorough, and efficient, I highly recommend.
Nicolas - April Moto
Digital & E-commerce Director
We are very satisfied with Paul's work. He is quick, available, and particularly effective. Since his arrival, very good results have been observed, both in terms of performance and responsiveness. A real asset for our team.
Léo - Luxury brand
E-commerce Product Owner
I don't know if we've said it enough.
But if you want to improve your loading speed,
Make Google happy and get your Core Web Vitals in the green,
Contact Paul Delcloy.
Florian Darroman - Les Makers
Co-founder
Python web, mature ecosystem and many backend levers
Python powers a significant share of web backends: Django for complete applications, Flask for APIs and microservices, FastAPI for modern async APIs, and increasingly Litestar or Starlette for performance-focused stacks. On web performance, Python levers are mostly backend — the frontend is served by another stack (React, Vue, Next.js).
The web performance optimization angle on Python is multi-layer: ORM (Django ORM, SQLAlchemy) profiled against N+1, synchronous views converted to async when relevant, gunicorn or uvicorn configuration calibrated to traffic profile, caching layers (Redis, Memcached) to reduce DB load, and async compilation of blocking dependencies.
Django ORM and SQL queries, first work-stream
Django ORM is powerful and expressive, but like all ORMs it easily exposes to N+1. A view listing 50 objects with relations without select_related() or prefetch_related() triggers 51 SQL queries. On LCP-critical pages, this pattern is among the leading causes of drifting TTFB.
Django Debug Toolbar or django-silk diagnosis exposes N+1 immediately. Refactoring (select_related for FK, prefetch_related for ManyToMany, scalar queries via .values() for listings) drops TTFB 40 to 70% on affected pages.
Async views and calibrated workers
Django 4+ and FastAPI natively support async views. For endpoints making outbound HTTP calls (third-party services, external APIs), moving to async frees the worker to handle other requests during I/O wait. Throughput climbs, perceived TTFB drops at peaks.
gunicorn calibration (workers, worker class — gthread vs uvicorn vs gevent — connections) or uvicorn (workers, loop policy) is the other angle. A miscalibrated config leaves 50% of CPU unused or, conversely, saturates on threads. Proper tuning (often workers = 2 * cpu_cores + 1) unblocks the situation.
Other expertise Technologies
Angular
Angular optimized: lazy modules, OnPush change detection, SSR Universal or Analog, signals, zone.js elimination. Stable Core Web Vitals on enterprise SPAs.
Learn moreAstro
Astro optimized: islands architecture, image optimization, view transitions, content collections. Near-static sites with green Core Web Vitals.
Learn moreDrupal
Drupal optimized: Render API and cache contexts, Dynamic Page Cache + BigPipe, Views performance, MySQL tuning. Core Web Vitals green on strategic templates.
Learn more