Saurabh 😎

WWDC 2018: Optimizing Your App for Today's Internet

4 billion people now on the Internet - most growth now comes from non-human Internet users, e.g. servers, bots, IoT devices, etc.

Use Network Link Conditioner (NLC) to simulate 2G networks

Avoid SCNetworkReachability since reachability info can go stale very quickly (e.g. user enters a tunnel) - instead, just connect using waitsForConnectivity

TLS 1.3 is now standardized, so will soon be enabled by default
Make sure your backend server supports latest TLS

Certificate Transparency - guards against rogue certificate authority that issue bogus certificates
All new TLS certificates must be publicly logged and CT-validated

Your hardware must pass Bonjour Conformance Test to use the Bonjour trademarks in your marketing

BSD Sockets API was created when networking was in its infancy
Now, use Network.framework for low-level network (which is what URLSession uses under the hood)
Avoid BSD sockets (and avoid 3rd party libraries using BSD sockets)

IPv6

Apple engineers gathered network data in India and found that IPv6 had much lower setup latency than IPv4 - but only 30% of networks in India support IPv6
In USA, 87% of mobile carriers offer IPv6

Make sure that IPv6 is enabled for your backend servers!

ECN

Make sure your backend server supports ECN

Multipath TCP (MPTCP)

Much faster to "hot" failover connections from e.g. WiFi to cellular

See WWDC 2017 Advances in Networking Part 1

78% of carriers worldwide support MPTCP
22% worldwide carriers block it

QUIC

QUIC is the first serious successor to TCP

Apple will add platform support once it's standardized

DNS

Most websites use short TTLs to enable fast failover - but majority of the time, there are no failures so lots of excessive DNS refresh requests (plus, some carriers ignore the TTL and cache for longer anyways)

Optimistic DNS - connection will use the cached DNS value, but will also send the DNS request in the background