2. A Very Special Thanks to …
… the following folks for helping with the presentation:
• Ashish Khivesara – IPhone/Android UI Development
• Daniel Jacobson – Director of API
• Shyan-Ming Perng – PS3/IPad/IPhone UI Development
• Mike Cohen – API Development
• Yury Izrailevsky – Director of Cloud Systems
… the entire company for pulling together to make Netflix for
Mobile in the Cloud a reality!
mobile first
Intuit Proprietary & Confidential
3. mobile first
Our Business
No Longer Going Postal!
4. Our Business
In 1999
• Netflix launched DVD rentals-by-mail
– Unlimited rentals for a flat monthly fee
– No due dates
– No late fees
– No shipping or handling fees
– First attempt to target long-tail rental market
• We can ship any of >100K titles, whereas Brick-and-
Mortar are constrained by how much space they can rent
- Only 1-2k rentals
mobile first
Intuit Proprietary & Confidential
5. Our Business
Fast Forward to 2008
• Netflix forecasts the gradual end of the DVD and
starts switching to Movie Streaming
• Upside?
– We spend $500MM to $600MM annually on US
Postage for DVD mailing
– Streaming a movie is a fraction of the cost of shipping
a DVD
– Easier to craft a business model for international
expansion
mobile first
Intuit Proprietary & Confidential
6. Our Business
• We have 22M+ subscribers in the US and Canada
• May account for 20% of US peak downstream
bandwidth usage
• A top CDN user in the US
• Limelight, Akamai, & Level 3 deliver images and movies
• Grew subscribers 2008-2010 by partnering with
device makers
mobile first
Intuit Proprietary & Confidential
7. Our Business
• A world of connected devices, some mobile
mobile first
Intuit Proprietary & Confidential
9. Our Problem
• Circa late 2008, Netflix had a single data center
– Single-point-of-failure (a.k.a. SPOF)
– Approaching limits on cooling, power, space, traffic capacity
• Alternatives
– Build more data centers
– Outsource the majority of our capacity planning and scale out
• Allows us to focus on core competencies
mobile first
Intuit Proprietary & Confidential
10. Our Problem’s Solution!
• Winner : Outsource the majority of our capacity planning
and scale out
– Leverage a leading Infrastructure-as-a-service provider
• Amazon Web Services
• Footnote : As it has taken us a while (i.e. ~2+ years) to
realize our vision of running on the cloud, we needed an
interim solution to handle growth
– We did build a second data center along the way
• We did outgrow it soon afterward!
mobile first
Intuit Proprietary & Confidential
12. Cloud Migration Strategy
• Components
– Applications and Software Infrastructure
– Data
• Migration Considerations
– Security
• PII and PCI DSS stays in our DC, rest can go to the cloud
– Web Scale – this goes!
mobile first
Intuit Proprietary & Confidential
16. Cloud Migration Strategy
Examples of Applications that can be moved
• Web Scale
– Personalized Video Discovery (e.g. browsing movie lists on the IPhone)
– Streaming Video Playback (e.g. watching a movie on the IPhone)
• Off-line
– Video Encoding
• Encode and store in final form in CDN
• ~40 encodes from a single mezzanine : bit rates, screen resolutions, codecs, etc…
• Infrastructure
– Log Capture & Analysis, Monitoring, Alerting
mobile first
Intuit Proprietary & Confidential
17. Cloud Migration Strategy
Examples of Data that can be moved
• Video-centric data
– Critics’ and Users’ reviews
– Video Metadata (e.g. director, actors, plot description, etc…)
• User-video-centric data – some of our largest data sets
– Video Queue
– Watched History
– Video Ratings (i.e. a 5-star rating system)
– Video Playback Metadata (e.g. streaming bookmarks, activity logs)
mobile first
Intuit Proprietary & Confidential
18. mobile first
Cloud Migration
What Does the Cloud Offer?
19. Cloud Migration
“The cloud lets its users focus on
delivering differentiating business value
instead of wasting valuable resources
on the undifferentiated heavy lifting
that makes up most of IT
infrastructure.”
- Werner Vogels, CTO, Amazon
August 25, 2009, ‘All Things Distributed’
mobile first
Intuit Proprietary & Confidential
20. mobile first
AWS Services We Use
Messaging Services
21. Messaging Services
Data Center Amazon Web Services
WebLogic Messaging SQS (Message Queues)
SNS (Message Topics)
mobile first
Intuit Proprietary & Confidential
22. Messaging Services
• Use-cases for Message Queues
– System Dependency Decoupling
• e.g. Decouple Cloud and DC applications
- When user adds a movie to the instant queue in the cloud, we
send the update back to the DC for DC-resident applications
- Message consumers are decoupled from message producers
– Fire-and-forget Write Scalability
• e.g. Application Logging
- Write to BI storage
- Consumers can process messages at their own rate
mobile first
Intuit Proprietary & Confidential
23. Messaging Services
• SQS
– Infinitely Scalable but does not guarantee in-order
message delivery
– Never worry about overflowing the queue and
crashing or becoming unresponsive!
• Often a problem with enterprise messaging systems
– Messages are automatically dropped from queues
after a maximum of 4 days
mobile first
Intuit Proprietary & Confidential
24. Messaging Services
• SQS
– API for Queue Management
• CreateQueue
• ListQueues
• DeleteQueue
– API for Message Management
• SendMessage (up to 64K in size)
• ReceiveMessage (up to 10 messages in a batch)
• DeleteMessage (a.k.a. ACK Message)
• SetVisibilityTimeout – after which, a message becomes visible to
other ReceivedMessage calls
mobile first
Intuit Proprietary & Confidential
26. Persistence
Data Center Amazon Web Services
Oracle SimpleDB
S3
Cassandra
mobile first
Intuit Proprietary & Confidential
27. Persistence
An ideal storage solution should have the following features:
þ Hosted
þ Managed Distribution Model
þ Works in AWS
þ AP from CAP
þ Handles a majority of use-cases accessing high-growth, high-traffic
data
þ Specifically, key access by customer id, movie id, or both
mobile first
Intuit Proprietary & Confidential
28. Persistence
• We picked SimpleDB and S3
– SimpleDB was targeted as the AP equivalent of our RDBMS
databases in our Data Center
– S3 was used for data sets where item or row data exceeded
SimpleDB limits and could be looked up purely by a single key
(i.e. does not require secondary indices and complex query
semantics)
• Video encodes
• Streaming device activity logs (i.e. CLOB, BLOB, etc…)
• Compressed (old) Rental History
mobile first
Intuit Proprietary & Confidential
29. Persistence
Terminology
SimpleDB Hash Table Relational
Databases
Domain Hash Table Table
Item Entry Row
Item Name Key Mandatory Primary
Key
Attribute Part of the Entry Column
Value
mobile first
Intuit Proprietary & Confidential
30. Persistence
Soccer Players
Key Value
Nickname = Wizard of Teams = Leeds United,
ab12ocs12v9 First Name = Harold Last Name = Kewell Oz Liverpool, Galatasaray
Nickname = Czech Teams = Lazio,
b24h3b3403b First Name = Pavel Last Name = Nedved Cannon Juventus
Teams = Sporting,
Manchester United,
cc89c9dc892 First Name = Cristiano Last Name = Ronaldo Real Madrid
SimpleDB’s salient characteristics
• SimpleDB offers a range of consistency options
• SimpleDB domains are sparse and schema-less
• The Key and all Attributes are indexed
• Each item must have a unique Key
• An item contains a set of Attributes
• Each Attribute has a name
• Each Attribute has a set of values
• All data is stored as UTF-8 character strings (i.e. no support for types such as numbers or
dates)
mobile first
Intuit Proprietary & Confidential
31. Persistence
What does the API look like?
• Manage Domains
– CreateDomain
– DeleteDomain
– ListDomains
– DomainMetaData
• Access Data
– Retrieving Data
• GetAttributes – returns a single item
• Select – returns multiple items using SQL syntax
– Writing Data
• PutAttributes – put single item
• BatchPutAttributes – put multiple items
– Removing Data
• DeleteAttributes – delete single item
• BatchDeleteAttributes – delete multiple items
mobile first
Intuit Proprietary & Confidential
33. Compute
Data Center Amazon Web Services
Hadoop EMR & S3
Servers EC2 – heavy use of reserved instances
Citrix Load Balancer • Elastic Load Balancer (ELB)
• Cloud Watch
• Auto Scale Group (ASG)
mobile first
Intuit Proprietary & Confidential
34. mobile first
Filling the Gaps
Netflix’s Undifferentiated Heavy Lifting
35. Filling the Gaps
AWS provides various IAAS offerings, but applications need more!
AWS IAAS
• Persistence
?
• SimpleDB, RDS, S3,
EBS
• Compute Netflix
• EC2, EMR, ASG, ELB Applications
• Monitoring
• CloudWatch
mobile first
Intuit Proprietary & Confidential
36. Filling the Gaps
AWS provides various IAAS offerings, but applications need more!
Hence the need for Netflix’s infrastructure team to bridge the gap!
AWS IAAS Netflix Platform
• Persistence • Platform.jar
• SimpleDB, RDS, S3, • Middle-tier Load
EBS Balancing
• Load Handling Netflix
• Discovery
• EC2, EMR, ASG, ELB Applications
• Monitoring
• Encryption Services
• CloudWatch • Caching
• Configuration
• GeoLocation
mobile first
Intuit Proprietary & Confidential
40. Mobile App Development Strategy
• We develop mobile web pages
that run in Web Kit where
available. Examples include:
• PS3
• IPhone/IPad/etc…
• Enables
• A/B Testing
• Fast Deployments
• Leveraging code across
devices (e.g. IPhone &
Android)
mobile first
Intuit Proprietary & Confidential
41. IPhone
• When you click on the app,
you see the splash screen
• It will disappear once we
start loading the Home
Page
mobile first
Intuit Proprietary & Confidential
42. IPhone
• Home Page Loading: Fetch
1. Time service
2. User resource
3. Rental History for resume feature
4. Fetch up to 12 Lists of Movies
1. Get 3 movies for the top-most
list (e.g. Children & Family)
2. After it loads, fetch 3 movies
for remaining 11 lists in
parallel – slows scrolling
5. Bulk rating request for all titles to
fetch the star bars
• Average 11 API calls on Home Page
mobile first
Intuit Proprietary & Confidential
43. IPhone
• User Interaction Reasoning (in red)
• Rental History for resume feature
• Promotes fastest movie launch
• Fetch up to 12 Lists of Movies
• Get 3 movies for the top-most
list (e.g. Children & Family)
• After it loads, fetch 3 movies for
remaining 11 lists in parallel
• Remaining 11 may slow
scrolling
• Bulk rating request for all titles to
fetch the star bars
• Absence is least obvious to user
mobile first
Intuit Proprietary & Confidential
46. Tips & Tricks – Prefetching
• On any list (e.g. Home) page, we prefetch
• Box Shot Image
• Title
• Ratings (i.e. star bar)
• Year, MPAA rating, Duration
• Synopsis
• On the Movie Display Page, we load/reload
• “In Q” button status
• Play or Resume button status
• Cast/Director
• Episode List (for TV Shows) or Simliars
(for Movies)
mobile first
Intuit Proprietary & Confidential
47. Tips & Tricks – Memory Savings
• To save memory, when we
navigate away from the MDP, we
unload the following:
• Similars (for Movies)
• Episodes (for TV Shows)
• We keep the Cast & Director
• On future visit to this MDP, we will
reload the following:
• Anything not loaded
• Button status for both buttons
mobile first
Intuit Proprietary & Confidential
48. Tips & Tricks – Bandwidth Savings
• Server responses are GZIP compressed
– Processor speed ample enough to handle the decompression
– Less power hungry than wireless 3G transfers of uncompressed
data
– Rules of thumb, keep payload 20-100KB per call
mobile first
Intuit Proprietary & Confidential
49. Tips & Tricks – Bandwidth Savings
• Revising Netflix REST Model
– Too chatty
– Too many round-trips
– Or it returns data that is not needed
• A lot of processing is needed to skip extraneous data
• Moving to a more structured query language (e.g. SQL-like)
• This will reduce memory, bandwidth use, and round-trips
• Great blog entry on the topic from Netflix’s Director of API
@daniel_jacobson
– http://techblog.netflix.com/2011/02/redesigning-netflix-
api.html
mobile first
Intuit Proprietary & Confidential
50. Tips & Tricks – Image Sprites
• Image Sprites are used to reduce memory
and bandwidth by giving the user the
impression of viewing different images,
when in fact there is only one
– Ratings Star Bars
– Footer (i.e. Home, Genres, Search, & Q)
mobile first
Intuit Proprietary & Confidential
51. Tips & Tricks – Image Sprites
With Some Markup
<span title="1 of 5" class="rating r1"><img width="0"
height="1" src="sprite.gif" alt=""/>1 out of 5</span>
<span title="2 of 5" class="rating r2"><img width="0"
height="1" src="sprite.gif" alt=""/>2 out of 5</span>
…..
And Some CSS
.rating {
position: relative;
height: 1.6em;
…..
mobile first
Intuit Proprietary & Confidential
52. Tips & Tricks – Security
• All traffic is over secure channels – https
– Deny Man-in-the-Middle attacks
• All requests are signed with a time
– Use Netflix Time Service to avoid clock-
skew
– Avoids replay attacks
mobile first
Intuit Proprietary & Confidential
54. Netflix IPhone App Demo
• Link can be found at the location below:
– http://blog.netflix.com/2010/08/netflix-now-available-on-your-iphone.html
mobile first
Intuit Proprietary & Confidential