Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading large files consumes a lot of memory #50

Open
toabi opened this issue Jul 26, 2024 · 2 comments
Open

Uploading large files consumes a lot of memory #50

toabi opened this issue Jul 26, 2024 · 2 comments

Comments

@toabi
Copy link

toabi commented Jul 26, 2024

https://github.com/theriverman/django-minio-backend/blob/3.6.0/django_minio_backend/models.py#L166-L181

The part here could also do multipart uploads when setting length=-1 and part_size=some_buffer_size. (see https://min.io/docs/minio/linux/developers/python/API.html#put-object-bucket-name-object-name-data-length-content-type-application-octet-stream-metadata-none-sse-none-progress-none-part-size-0-num-parallel-uploads-3-tags-none-retention-none-legal-hold-false)

As a local workaround I'm currently doing this:

s3_client = default_storage.client
result = s3_client.put_object(
    bucket_name=settings.MINIO_MEDIA_FILES_BUCKET,
    object_name=output_file_path,
    data=temp_file,
    length=-1,  # enable multipart upload
    part_size=MAXIMUM_CHUNK_SIZE_BYTES,  # max size per part
)

But it would be nice to have it as an option/setting/default…

@theriverman
Copy link
Owner

Would you be up for opening a PR to see how would you like to get this implemented, @toabi ?

@toabi
Copy link
Author

toabi commented Sep 8, 2024

Well… currently I don't have much ressources to spare, but if another project where we use this library will require it maybe it'll be worth to implement it properly without workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants