iOhYes Retired

iOhYes

A podcast by iOS developers for iOS developers, delivering news, tips, and rants for professional iOS/Mac developers, with something for enterprise and indie developers alike.

Hosted by Darryl Thomas and John Sextro.



← Previous Episode   |   Next Episode →

108: Peeling the Onion on Networking

April 20, 2016 at 9:15AM • 1 hour 15 minutes • Wiki Entry

Discussion

Testing normal networks (aka, not the US)

  • 62.5% of the world’s 3.2 Billion internet users have 2G connections (or worse). That number is growing. LTE speeds aren’t going to catch up for at least a decade if not much longer.
  • When building robust networking between your client apps and your services, the common case should be the default case. AKA: not WiFi and not LTE.
  • Things that help a great deal:
    • Test on 2G and flaky networks
      • Helps to do real world testing in parking garages, elevators and in transit.
      • Simulation will be the highest reproducible ROI way to test
    • Fail fast and accurately. Timeouts play a part in this.
    • Be dynamic with how you handle the network.
      • Slower speeds should have less networking
    • Use modern tech, like HTTP/2
    • Defer, defer, defer (and prioritize)
    • Robustly handle errors
      • If at first you don’t succeed, try again! And again and again. Retry policies can get you from one-9 of success to three-9s very simply.
    • Design your network API in a robust manner!
  • Simulating bad connections:
  • Timeouts

    • List of timeouts:
      • TCP: connection timeout (TLS connection timeout too), SYN timeout, keepalive/idle timeout, retransmission timeout
      • NSURL: request timeout (max time between data being received in response - default is 60 seconds), resource timeout (time for entire transfer to complete - default is 7 days)
      • Custom timeouts: transaction timeouts (time from initiation to completion including redirects and retries), queue timeout (how long can the request be queued without starting before it times), idle timeout (how long can a request do nothing regarding upload or download before timeout)
    • NSURLSession has a problem with scale. Every different configuration setting requires another NSURLSession to be maintained and managed. Timeouts, different default headers, different TLS settings, different cookie settings, different NSURLCache, cellular vs non-cellular
  • Robust API design

    • Transactional APIs
    • Robust error codes (not just HTTP status codes!)
  • Retry policies to the rescue

Picks

Darryl

  • Pain Free Constraints with Layout Anchors - A bit of follow-up from last week’s episode. I felt like John and I were having trouble explaining anchors, and I remembered this article from a few weeks back.

Nolan

Alternative show title suggestions

  • Just remember: You’re wrong
  • Not all requests are made equal
  • Item potency



Show Notes & Links Presented by CacheFly

Tweet Shoutouts