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

Use multipartupload for uploading chunks to s3 #2541

Merged

Conversation

mpivchev
Copy link
Collaborator

@mpivchev mpivchev commented Jul 19, 2023

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev mpivchev changed the title WIP S3 Multiupload Jul 19, 2023
@mpivchev mpivchev changed the title S3 Multiupload Use multipartupload for uploading chunks to s3 Jul 19, 2023
@mpivchev
Copy link
Collaborator Author

mpivchev commented Jul 19, 2023

@marinofaggiana @tobiasKaminsky Why do we need to specify the chunk size manually inside the apps? On web chunking happens automatically.

Also, you have to adjust it constantly if you upload different files. For example I wanted to upload a 20 MB file so I set the chunks to 5MBs, but then I wanted to upload a 20 GB file and I wanted to change them to 1GB. Having this done automatically would be a much better experience. We can still keep the option for manual chunk size as well.

@marinofaggiana Second thing, the docs specify that the min chunk is 5MB and the max can be 5GB. Currently, the max in the app is 100MB. Can we increase it?

@mpivchev
Copy link
Collaborator Author

mpivchev commented Jul 19, 2023

What else to add:

  • Min chunk size is 5 MiB = 5242880 bytes. Our chunk code works with MBs, so to not overcomplicate things, the min chunk size will be set to 10MB instead.
  • Change the chunk size UI element to have 10MB as min size.
  • If a user has currently set their chunk size to <10, we need to reset it.

@marinofaggiana
Copy link
Member

marinofaggiana commented Jul 19, 2023

@mpivchev

  • yes, we can increase it
  • if we decide to set it automatically, we have to implement the control in auto upload:
    • if the file (image/video) is a chuck file then it is not sent in the background, I can easily handle this one
  • the upload GUI needs to be changed (Instagram example):

IMG_1074

@mpivchev mpivchev mentioned this pull request Jul 19, 2023
mpivchev added 2 commits July 19, 2023 17:55
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev mpivchev linked an issue Jul 21, 2023 that may be closed by this pull request
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
+ (void)setChunkSize:(NSInteger)size
{
if (size < 10) size = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the size should still be default to the minimum supported value of 5MB then if configured to be > 0.

Maybe there is some byte calculation in another place where the 5 MB -> bytes generates the wrong value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this two function and use the new algorithm

juliusknorr
juliusknorr previously approved these changes Jul 25, 2023
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment left regarding the chunk size, but tested and works and also verified that the S3 upload mechanism is properly used.

mpivchev added 2 commits July 25, 2023 16:19
…use-multipartupload-for-uploading-chunks-to-s3-2

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>

# Conflicts:
#	Nextcloud.xcodeproj/project.pbxproj
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Comment on lines -673 to +686

if (size == nil) {
NSInteger sizeInt = [size integerValue];

if (size == nil || sizeInt < 10) {
return 0;
} else {
return [size integerValue];
}
}

/// In megabytes (MB)
+ (void)setChunkSize:(NSInteger)size
{
if (size < 10) size = 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Int checks are temporary until we add auto chunking

@mpivchev mpivchev marked this pull request as ready for review July 25, 2023 14:52
@mpivchev mpivchev requested a review from marinofaggiana July 25, 2023 14:53
@mpivchev
Copy link
Collaborator Author

This closes #2471

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.55% 🎉

Comparison is base (8dbf5fc) 9.37% compared to head (a9eb4da) 9.92%.

❗ Current head a9eb4da differs from pull request most recent head 3f13bd9. Consider uploading reports for the commit 3f13bd9 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #2541      +/-   ##
==========================================
+ Coverage     9.37%   9.92%   +0.55%     
==========================================
  Files          185     185              
  Lines        26355   26361       +6     
  Branches      9827    9829       +2     
==========================================
+ Hits          2471    2617     +146     
+ Misses       23669   23519     -150     
- Partials       215     225      +10     
Files Changed Coverage Δ
iOSClient/Data/NCManageDatabase.swift 17.88% <ø> (ø)
...SClient/Networking/NCNetworkingChunkedUpload.swift 0.00% <0.00%> (ø)
iOSClient/Settings/CCAdvanced.m 0.00% <0.00%> (ø)
iOSClient/Utility/CCUtility.m 22.97% <0.00%> (-0.07%) ⬇️

... and 12 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

+ (void)setChunkSize:(NSInteger)size
{
if (size < 10) size = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this two function and use the new algorithm

@mpivchev
Copy link
Collaborator Author

@marinofaggiana Bad idea since we still have the option in settings to change chunks. I added a new issue that will implement this. I suggest we keep this for now. #2547

…use-multipartupload-for-uploading-chunks-to-s3-2

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>

# Conflicts:
#	Nextcloud.xcodeproj/project.pbxproj
@mpivchev mpivchev merged commit adb2909 into develop Jul 27, 2023
@delete-merged-branch delete-merged-branch bot deleted the 2471-use-multipartupload-for-uploading-chunks-to-s3-2 branch July 27, 2023 14:58
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

Successfully merging this pull request may close these issues.

Use MultipartUpload for uploading chunks to s3
3 participants