29
aling with Unreliable Networks Director, Twitter Jess Garms

Dealing with Unreliable Networks

  • Upload
    jgarms

  • View
    119

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Dealing with Unreliable Networks

Dealing with Unreliable Networks

Director, TwitterJess Garms

Page 2: Dealing with Unreliable Networks

Dealing with Unreliable Networks

1.Reliability2.Resiliency3.Performance4.Empathy

Page 3: Dealing with Unreliable Networks

Networks Around the World

Page 4: Dealing with Unreliable Networks

Reliability

Page 5: Dealing with Unreliable Networks

Tweet

Page 6: Dealing with Unreliable Networks

What if that network call fails?

Page 7: Dealing with Unreliable Networks

Solution: Retry

Page 8: Dealing with Unreliable Networks

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;}

Page 9: Dealing with Unreliable Networks

Android:

try { readResponse()} catch (IOException ioe) { markForRetry();}

Page 10: Dealing with Unreliable Networks

Idempotency

Page 11: Dealing with Unreliable Networks

Resiliency

Page 12: Dealing with Unreliable Networks

Performance

Objectivevs

Perceived

Page 13: Dealing with Unreliable Networks

Points of Presence (POPs)

Page 14: Dealing with Unreliable Networks

HTTP/2 & SPDYHTTP/1.1

HTTP/2

Page 15: Dealing with Unreliable Networks

WebP

Page 16: Dealing with Unreliable Networks

Progressive JPEG

Page 17: Dealing with Unreliable Networks

Low-res Images

Page 18: Dealing with Unreliable Networks

Waiting for requests

Page 19: Dealing with Unreliable Networks

Request Prioritization1. User actions2. Foreground API requests3. Images4. Background API requests5. Prefetching and Polling

Page 20: Dealing with Unreliable Networks

Communicate Network

Status

Page 21: Dealing with Unreliable Networks

Network Forecasting

Page 22: Dealing with Unreliable Networks

Empathy

Page 23: Dealing with Unreliable Networks

Measure!

Page 24: Dealing with Unreliable Networks

Grey Box Times

Page 25: Dealing with Unreliable Networks

Network Debugging

Page 26: Dealing with Unreliable Networks

Network Simulation

Page 27: Dealing with Unreliable Networks

1. Never rely on a network call succeeding quickly2. No silver bullet: many separate fixes

Conclusions

Page 28: Dealing with Unreliable Networks

https://about.twitter.com/careers

Interested in working on these problems?

Page 29: Dealing with Unreliable Networks