-
Notifications
You must be signed in to change notification settings - Fork 113
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
Provide objectSize for S3 upload to reduce memory usage #1933
Comments
@aduffeck @butonic this looks like a pretty nice improvement. Can you take a look at @AndreasSko's changes? |
@AndreasSko nice find. I think it would be good to keep the Did you try specifying the _, err := bs.client.PutObject(context.Background(), bs.bucket, key, reader, size, minio.PutObjectOptions{
ContentType: "application/octet-stream",
PartSize: 100 * 1024 * 1024,
}) would work. |
If that's not an option maybe we could try to infer the file size dynamically if possible instead, e.g. like so (untested) size := int64(-1)
if file, ok := reader.(*os.File); ok {
info, err := file.Stat()
if err != nil {
return err
}
size = int64(info.Size())
}
_, err := bs.client.PutObject(context.Background(), bs.bucket, key, reader, size, minio.PutObjectOptions{ContentType: "application/octet-stream"}) |
Yeah, that's a good idea! I will try that out and open a PR if it looks good. Thank you! 🙂 |
When using OCIS with the S3ng storage enabled, I noticed relatively high memory usage when uploading files. This could be more than 1GB for a single user. I did a bit of digging and noticed that in
reva/pkg/storage/fs/s3ng/blobstore/blobstore.go
Line 63 in 7d251bf
-1
. According to minio/minio-go#1496 this can result in the observed memory usage.I did some testing on my own and checked what will happen if the correct size is provided. In my testing, the memory usage of OCIS was reduced significantly - from >1GB down to <300MB.
If you like, I'm happy to open a PR to fix this issue. The question is: What would be the best way? In AndreasSko@be1e7de I changed the interfaces for
reva/pkg/storage/utils/decomposedfs/decomposedfs.go
Line 74 in aad6c51
reva/pkg/storage/utils/decomposedfs/tree/tree.go
Line 48 in aad6c51
*os.File
instead of anio.Reader
. But I could imagine to also simply provide the fileSize as an int64 directly. I'm open for feedback here 🙂Related issue: owncloud/ocis#2326
The text was updated successfully, but these errors were encountered: