I'm currently developing an iOS app with image upload functionality.
To enhance upload speed, I'm considering implementing parallel uploads using Swift’s TaskGroup.
However, I have concerns that in environments with limited bandwidth, parallelization might introduce overhead and contention, ultimately slowing down uploads instead of improving them.
Specifically, I'm curious about:
Is this concern valid? Does parallelizing uploads become counterproductive in low-bandwidth conditions due to overhead and network contention?
If so, I'm considering dynamically adjusting the concurrency level based on network conditions. Does anyone have experience or best practices regarding such an approach?
Any insights or advice would be greatly appreciated.
Thank you!
Yes. The details vary based on the specific protocol you’re using but, in general, going ‘too wide’ will waste resources and can potentially slow things down.
As to what you should do, that depends on a bunch of factors:
-
How large are the images? And how many do you have to upload?
-
What protocol are you using?
-
If it’s HTTP[S], are you using a background session?
-
Are you talking to one specific server? Or do you need to work with a lot of different servers?
-
If it’s one server, what HTTP version does it use?
IMPORTANT There’s a big difference between HTTP/1 and HTTP/{2,3} when it comes to parallelism. If you’re still using HTTP/1, you’ll likely get more ‘bang for your buck’ by upgrading the server to HTTP/2 than by tweaking your client.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"