amplify-swift: Upload to S3 slows to halt after queueing multiple files

Describe the bug

I need to queue several thousand images for background upload into S3. However, the more files I add by calling Amplify.Storage.uploadFile the slower everything seems to get - after about 20 it essentially seem to be doing little at all (ie hardly get any file progress notifications, and zero completions).

It looks as if there’s no queueing mechanism and Amplify is just trying to upload everything at once. I’m not sure if this is a bug or a limitation - but could you confirm how to approach this?

I could use an OperationQueue locally, but then I lose the ability for these jobs to continue in the background.

I could compress it all into one big zip file and extract on the other end, but then on a slow internet connection they won’t receive any of the data until the whole lot has gone up.

To Reproduce Steps to reproduce the behavior:

  1. upload multiple files using Amplify.Storage.uploadFile simultaneously

Observed Behavior

The more files I add by calling Amplify.Storage.uploadFile the slower everything seems to get.

Expected Behavior

I should be able to queue multiple files for background uploading using Amplify.storage.uploadFile

Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?

Storage

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (13 by maintainers)

Most upvoted comments

Thanks for reporting this, we’ll need to investigate. I haven’t reviewed the code in a while, but my recollection is that we submit each upload task to an NSURLSession configured for background operation as soon as Amplify receives the request. The OS should manage parallel tasks transparently, so it’s unexpected that we’d see a problem handling multiple tasks.