Chapter 7. Network

With the necessity to use networking in an app and with limited choices for minimizing latency (e.g., using CDNs or edge servers or using smaller payload formats like Protobuf or data compressions), everything gets down to best utilizing the available network conditions and planning ahead for varying scenarios.

In this chapter, we look at the factors that impact the overall latency and how you can make best use of the information available to maximize performance.

Metrics and Measurement

Most of the work done in networking is outside of your control, so it is important to identify the metrics to measure. We will discuss some of the more important performance-related metrics in this chapter. Note that this is not intended to be a comprehensive list, but just to point out the more important ones to measure in relation to optimizing performance.

Figure 7-1 shows a bird’s-eye view of a typical request over the network.

hpia 0701
Figure 7-1. Network—device to server

The general structure of the discussions that follow is a description of the metric of concern, one or a couple of examples, followed by best practices.

DNS Lookup Time

The first step to initiating a connection is DNS lookup. If your app is network heavy, DNS lookup times can slow it down. In a rigorous statistical sample of two locations, DNS lookup time to the host www.google.com from Sunnyvale, California, ...

Get High Performance iOS Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.