-
Reduce network delays for your app
CPU performance and network throughput rates keep improving, but the speed of light is one limit that isn't going any higher. Learn the APIs and best practices to maximize your app's responsiveness and efficiency by keeping network round-trip times low and minimizing the number of round trips when performing network operations.
Ressources
Vidéos connexes
WWDC22
WWDC21
WWDC19
WWDC18
WWDC15
-
Rechercher dans cette vidéo…
-
-
9:28 - Fast open with TCP handshake
/* Allow fast open on the connection parameters */ parameters.allowFastOpen = true let connection = NWConnection(to: endpoint, using: parameters) /* Call send with idempotent initial data before starting the connection */ connection.send(content: initialData, completion: .idempotent) connection.start(queue: myQueue) -
11:01 - Sockets with fast open
connectx(fd, ..., CONNECT_DATA_IDEMPOTENT | CONNECT_RESUME_ON_READ_WRITE, ...); // delay SYN write(fd, ...); // SYN goes out with first data segment -
13:35 - Save round-trips when switching networks with Multipath TCP
// Multipath TCP // Save multiple round-trips when switching networks // On URLSessionConfiguration let configuration = URLSessionConfiguration.default configuration.multipathServiceType = .interactive // On NWParameters let parameters = NWParameters.tcp parameters.multipathServiceType = .interactive -
20:09 - Background service type, App in foreground
//Use default URLSession, set background on URLRequest var request = URLRequest(url: myurl) request.networkServiceType = .background //Set service class on parameters to apply to the NWConnection let parameters = NWParameters.tls parameters.serviceClass = .background -
20:10 - Time insensitive tasks running in background
//Configure background URL Session lazy var urlSession: URLSession = { let configuration = URLSessionConfiguration.background(withIdentifier: "MySession") configuration.isDiscretionary = true return URLSession(configuration: configuration, delegate: self, delegateQueue: nil) }()
-