Serving Files in Python: How FastAPI Failed Us

  • As the post points out, Python web frameworks have historically not prioritized improving the performance of serving static files, and that seems… fine?

    If we assume that all projects have a finite amount of engineering effort available, then triaging is expected. The best practice for production web applications for decades has been to serve them from behind a reverse proxy. From there, it is usually fairly trivial to use path matching to serve static files from the reverse proxy itself, a tool that is much better suited to this purpose and can easily saturate any link you throw at it without breaking a sweat.

    It seems perfectly reasonable for the maintainers of these web frameworks to defer improving the performance of static file serving indefinitely given this.

  • These don’t seem to be equivalent comparisons when you start using different ways of running the applications and whatnot. On one hand this compares uvicorn running an ASGI FastAPI app and another tests a raw script running a server it seems. I need to do some research on aiohttp’s server to speak definitively but as written, I don’t trust these results.

  • Looking forward to the pull requests