FastAPI performance optimization

Logo
Table of contents

FastAPI performance tuning

FastAPI is a great, high performance web framework but far from perfect. This document is intended to provide some tips and ideas to get the most out of it

Fastapi Middleware performance tuning

Fastapi JSON response classes comparison

Gunicorn workers and threads

Nginx in front of FastAPI

Connection keepalive

Stay tuned for new ideas:

Sync / async API endpoints

Connection pool size of external resources

FastAPI application profiling

Arbitrary place of code

Profiling middleware

Test environment