0

I am using Pre-Signed url (generated from our server), to upload to S3 bucket. Using URLSession background session to upload from file to signed URL.

What I have noticed is, if the video is bigger (more than 30 or 50 MB), the upload is really slow. My internet speed is decent with close to 300 Mbps also did real time speed testing and it was coming to >10 MBPS download and upload.

Here is how I am creating session and upload task from file,

let sessionConfiguration : URLSessionConfiguration = URLSessionConfiguration.background(withIdentifier: "SOME_REVERSE_DOMAIN_STRING.backgroundSession")
            sessionConfiguration.allowsCellularAccess = true

 let backgroundSession: URLSession = URLSession(configuration: sessionConfiguration,delegate: self,delegateQueue:OperationQueue.main)

Upload Task, a basic usage nothing fancy here:

uploadsSession.uploadTask(with: request, fromFile: fileUrl!)
task.resume()

Should I use AWS SDK or Amplify framework and upload? will it make any difference.

infiniteLoop
  • 2,135
  • 1
  • 25
  • 29
  • Have you looked at [Amazon S3 Transfer Acceleration](https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)? – Marcin May 05 '20 at 06:49
  • Ya, its premium service, my concern is its simple image upload and it should not be this slow. Seems like AWS is promoting Acceleration indirectly :P – infiniteLoop May 08 '20 at 06:43

1 Answers1

-1

To accelerate process you can use multipart upload. In your case without SDK you have to generate a signed URL request for each operation. Next option is to use S3 Transfer Acceleration.

suchorsky
  • 17
  • 4
  • multi-part upload would not work on the background sessions because you are putting entire blob data to a body data and doing upload from there. If you configure your URLSession to work on background sessions. you would get an error saying that "NSData are not supported in background sessions". – AlkanV May 19 '22 at 13:17