How to prevent background NSURLSession upload tasks from saturating uplink?

I'm working on an application that queues a number of media assets for background upload. Internal testing has revealed that on net connections with slower uplinks (~5-10mbit), the upload process can get saturated to the point other services on the network don't work.


Since this may be a common scenario for users in certain areas of the world, we're looking for ways to throttle the upload. We're chunking our files in 8MB pieces and creating background upload tasks for each under one NSURLSession. Other than the "discretionary" priority setting, there isn't much else we can control about the upload on the client side.


Should we look at throttling uploads on the server side? Is there a recommended approach for cases like this?


Thank you!

Replies

Transfers in a background session should automatically use the background network service type (

NSURLNetworkServiceTypeBackground
). You should try setting that explicitly on each request (via the
networkServiceType
property of
NSURLRequest
) or on the session as a whole (via the
networkServiceType
on
NSURLSessionConfiguration
) but I doubt that will yield any benefit. And if that supposition is correct then I can’t see any easy way around this.

Whatever else you do here you should file a bug about this, ideally including an RVI packet trace (per QA1176 Getting a Packet Trace). Resolving issues like this is hard, but that doesn’t mean it can’t be done.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"