"Hypermedia APIs provide loose coupling between an API and its client, allowing the API to evolve without client changes. When operating a hypermedia-based service with heavy usage, this evolvability introduces opportunities to improve scalability, as well as adding some new challenges.
Using Comcast’s experiences with the Xfinity Stream app, we will discuss how to use hypermedia to shape traffic and calling patterns, how to perform load shedding if necessary, and how to introduce API changes when it can take days for new versions of a service to fully rollout to clients. Implications for both API services and clients are considered."
4. Xfinity Stream Architecture
Hypermedia At Scale4
The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
The Roku image was created by IntelFreePress and is reproduced under the Creative Commons 20 Attribution License: https://creativecommons.org/licenses/by/2.0/legalcode
Other images are public domain or used with permission.
7. The Live TV Guide
Hypermedia At Scale7
2 weeks worth of listings = Over 60 MB of JSON
8. Hypermedia At Scale8
Grid Shape
URI: /guide/gridshape
startTime: 11/1/2017 7:55 PM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/1/2017 7:55 PM
endTime: 11/2/2017 12:00 AM
chunk
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 12:00 AM
endTime: 11/2/2017 4:00 AM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 04:00 AM
endTime: 11/2/2017 08:00 AM
chunk chunk
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
…
chunk
REST Resource
Hypermedia Link Relation
9. Managing the top of the hour spike
• Scale your service horizontally.
-Expensive.
-May not protect upstream services.
Hypermedia At Scale9
10. Managing the top of the hour spike
Hypermedia At Scale10
• Introduce prefetching or jitter into the client.
-Do you control your clients?
-If you do, how long does it take to get an update out?
11. Managing the top of the hour spike
• Introduce jitter from the server side.
Hypermedia At Scale11
12. Hypermedia At Scale12
Grid Shape
URI: /guide/gridshape
startTime: 11/1/2017 7:55 PM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/1/2017 7:55 PM
endTime: 11/2/2017 12:00 AM
chunk
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 12:00 AM
endTime: 11/2/2017 4:00 AM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 04:00 AM
endTime: 11/2/2017 08:00 AM
chunk chunk
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
…
chunk
REST Resource
Hypermedia Link Relation
13. Hypermedia At Scale13
Grid Shape
URI: /guide/gridshape
startTime: 11/1/2017 7:55 PM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/1/2017 7:55 PM
endTime: 11/2/2017 12:00 AM
chunk
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 12:00 AM
endTime: 11/2/2017 4:00 AM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 04:00 AM
endTime: 11/2/2017 08:00 AM
chunk chunk
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
…
chunk
REST Resource
Hypermedia Link Relation
Grid Shape
URI: /guide/gridshape
startTime: 11/1/2017 7:55 PM
chunk
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 12:00 AM
endTime: 11/2/2017 4:00 AM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/2/2017 04:00 AM
endTime: 11/2/2017 08:00 AM
chunk chunk
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
startTime: 11/2/2017 03:30 AM
endTime: 11/2/2017 07:30 AM
Grid Chunk
…
chunk
REST Resource
Hypermedia Link Relation
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/1/2017 7:55 PM
endTime: 11/2/2017 12:00 AM
Grid Chunk
URI: /guide/chunk?startTime=…
startTime: 11/1/2017 7:55 PM
endTime: 11/2/2017 12:05 AM
14. Managing the top of the hour spike
• Normalize linked resources across clients for efficient
caching.
Hypermedia At Scale14
16. Hypermedia At Scale
Hypermedia At Scale16
• Hypermedia improves scalability by allowing the service to
shape behavior without client-side code changes.
• Resources and links can change and evolve as the need for
scalability increases.
• Be mindful of the cacheability of your resources, even if
you don’t need to cache them yet.
Ben Greenberg
Benjamin_Greenberg@comcast.com
@bengreen