Fileuploads blocking Workers

Hello everybody,

I encountered a problem which got pretty big for my app now. Sometimes the app becomes unresponsive for a longer time and will answer the requests after like 50 seconds.

I think it is because a lot of users are uploading images and this blocks my gunicorn workers. Users might have a bad internet connection for example. Like this when 12 images are uploaded with bad connection and I only have 10 workers, this will cause a problem. (I also use Azure Blob Storage as my file storage). My Timeout Gunicorn setting is at 20 seconds.

I thought about making the Upload View async and changing to ASGI and Uvicorn. Or to bypass django and let user upload images directly to azure blob. I dont think that this will scale well though in terms of development work. If I have to write the bypass logic for every DRF View where I want to upload a file field.

How would you handle that?

Thank you in advance for your advice :slight_smile:

Actually something like this sounds promising:

But how would I make this scalable development time wise for all the models and views in my app?
Have one general FileImageModel and view for uploading?