important Delay in API Response Time with FastAPI when Handling Large File Uploads
I'm attempting to set up I tried several approaches but none seem to work... I'm working through a tutorial and I'm sure I'm missing something obvious here, but I've looked through the documentation and I'm still confused about I tried several approaches but none seem to work... I'm experiencing a considerable delay in response time when my FastAPI application handles large file uploads (around 100 MB). Despite the file size, the upload seems to succeed after a few minutes, but I notice that the server is unresponsive during this period. Iβm using FastAPI v0.68.0 with Uvicorn as the ASGI server. I've tried increasing the `upload_folder` size, but it hasn't improved performance. Hereβs a snippet of my file upload endpoint: ```python from fastapi import FastAPI, File, UploadFile import shutil app = FastAPI() @app.post("/upload/") async def upload_file(file: UploadFile = File(...)): with open(f"./uploads/{file.filename}", "wb") as buffer: shutil.copyfileobj(file.file, buffer) return {"filename": file.filename} ``` Iβve also attempted to set `--workers 4` when starting Uvicorn, but the performance optimization continue. Iβm curious if there are specific configurations or best practices I might be missing when dealing with large file uploads in FastAPI. Is there a way to optimize the processing time without compromising the upload functionality? Also, the following behavior message appears in my logs: `behavior: [Errno 28] No space left on device` after several uploads, which I suspect is related to temporary file storage. Any advice would be greatly appreciated! My development environment is Windows. Is there a better approach? Thanks in advance! My development environment is Linux. For reference, this is a production CLI tool. I'm open to any suggestions.