I'm working on a very high-traffic website project, with requirements similar to those of platforms like YouTube or Netflix. My goal is to build a highly optimized, scalable, secure, and, above all, completely thread-safe platform, without using asynchronous programming. Technical objectives: Use a non-blocking multithreaded architecture Run with Gunicorn (other if you can argue well) No async/await, no event loops, and all that stuff. Fine control over requests, middleware, headers, connection management, etc., and ESPECIALLY block management for uploads. A robust solution for real production use. What I tested and why I switched: Flask I started with Flask, which I found easy to get started with. The fact that each request is handled in a thread suited me well. But I had a revelation while working on file upload management: -- It's impossible to control chunks. Flask first receives the entire file in memory or on temporary disk, and only then can it be processed. As a result, a malicious user could upload very large files, saturating the server before I could even intervene. For me, this is a critical weakness, and it made me abandon Flask. FastAPI I then tried FastAPI, which I found more modern and, above all, more flexible for addressing lower layers (middleware, injection, etc.). But again, a major revelation: -- FastAPI is built around asynchronous processing, and that's a real constraint. Even when you just want to remain synchronous, you get stuck; some libraries no longer work as expected, and it complicates the code enormously. I find this model doesn't fit at all with an architecture based on synchronous multithreading. gunicorn -k uvicorn.workers.UvicornWorker --bind 192.168.1.30:8080 --workers 1 --threads 500 app:app What I'm looking for now is to find a better module or framework capable of: Supporting real, heavy production Offering maximum performance and stability Staying synchronized, thread-safe, without forced asynchrony And giving full control over fine-grained request management Two site rewrites in four days, I'm starting to wonder if the problem really lies with the frameworks... Now I'm on Django. I thought I'd hit rock bottom, but no: I'm still digging. (And I'm stuck on an error that even ChatGPT would be ashamed to invent.) At this rate, I'll be able to release a framework of my own... Please, help me... Continue reading...