-
Notifications
You must be signed in to change notification settings - Fork 24
Description
I am working on a project which is using Obstore in combination with FastAPI. I have implemented an endpoint to perform file uploads, what I noticed is that bigger files cause OOM errors due to put_async. Here are some details:
I have an endpoint (redacted for brevity) that looks like this:
@router.post(
"/upload",
)
async def upload(
request: Request,
):
# Stream the file to S3
store = S3Store(...)
await obstore.put_async(store, some_path, request.stream())
Since I am using request.stream() as the file I am expecting the put operation to directly stream the data to the S3 bucket. What is actually happening is that my application is crashing with an OOM error. The application is running in a pod with a limit of 2gb memory., the file I am uploading is 3.5gb. Increasing the limit solves the issue but this means multiple uploads to this service will still cause an OOM. For sanity I iterated over the request.stream() without put_async and this did not affect memory usage.
Any advice how to perform a streaming upload using Obstore?
Obstore version: 0.8.0
Python version: 3.13.5