Upload
jgarms
View
119
Download
1
Embed Size (px)
Citation preview
Dealing with Unreliable Networks
Director, TwitterJess Garms
Dealing with Unreliable Networks
1.Reliability2.Resiliency3.Performance4.Empathy
Networks Around the World
Reliability
Tweet
What if that network call fails?
Solution: Retry
iOS:- (BOOL)shouldRetryRequestWithError:(NSError *)error{ if ([error.domain isEqualToString:NSURLErrorDomain]) { if (... code from NSURLError.h should be retried ...) { return YES; } } else if ([error.domain isEqualToString:NSPOSIXErrorDomain]) { if (... code from errno.h should be retried ...) { return YES; } } return NO;}
Android:
try { readResponse()} catch (IOException ioe) { markForRetry();}
Idempotency
Resiliency
Performance
Objectivevs
Perceived
Points of Presence (POPs)
HTTP/2 & SPDYHTTP/1.1
HTTP/2
WebP
Progressive JPEG
Low-res Images
Waiting for requests
Request Prioritization1. User actions2. Foreground API requests3. Images4. Background API requests5. Prefetching and Polling
Communicate Network
Status
Network Forecasting
Empathy
Measure!
Grey Box Times
Network Debugging
Network Simulation
1. Never rely on a network call succeeding quickly2. No silver bullet: many separate fixes
Conclusions
https://about.twitter.com/careers
Interested in working on these problems?