SlideShare une entreprise Scribd logo
1  sur  120
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
A N E T F L I X E N G I N E E R I N G O R I G I N A L
A story of Netflix and AB Testing
in the User Interface Using
DynamoDB
Alex Liu @stinkydofualiu@netflix.com
A W S r e : I N V E N T
Alex Liu
Node.js Platform
aliu@netflix.com
@stinkydofu
#netflixeverywhere
Contents
I. The problem
II. Codex: Bundling as a service
III. Scaling for Netflix
IV. Looking to the future
I. The problem
It's all about building
JS bundles.
// home.js
require('foo');
require('bar');
home.js
home.js profile.js
feed.js signup.jsalbum.js
var bundles = [
'home.js',
'profile.js',
'feed.js',
'album.js',
'signup.js',
];
var bundles = [
'home.js',
'homeIE.js',
'profile',
'profileIE',
'feed.js',
'feedIE.js'
'album.js',
'albumIE.js',
...
];
/home
home.js homeIE.js
YESNO
Netflix
AB testing!
AB test w/ multiple cells
Cells Control (Cell 1) Cell 2 Cell 3
Movie
Cover
Art
14% 6%
Netflix
AB testing!
home.js
newSearch.jsoldSearch.js
home.js
newSearch.jsoldSearch.js
home.js
newSearch.jsoldSearch.js
jQuery React~80KB ~130KB
Larger bundle size:
• File sizes
• Time to download
• Memory usage
• Time to interactive (TTI)
Old-school Lego bricks
were generic.
New Lego is about
specialization.
Hard to reuse
specialized bricks.
home.js
newSearch.jsoldSearch.js
home.js
oldSearch.js
home.js
newSearch.js
// starting to look like a
// lot of bundles...
var bundles = [
'homeNewSearch.js',
'homeNewSearchIE.js',
'homeOldSearch.js',
'homeOldSearchIE.js',
...
];
4x variations
already!
Netflix runs hundreds of
AB tests.
But we personalize on many
other dimensions too.
|S1| ⋅ |S2| ⋅ ⋅ ⋅ |Sn| = |S1 × S2 × ⋅ ⋅ ⋅ × Sn|
3100
= 5.1537752e47
40,000,000,000 bricks to reach the
7,600,000,000,000,000 bricks to reach
Enough bricks to reach 6.7812832e32 times.
That’s a ton of bundles!
https://xkcd.com/303/
Website's full
bundle is 8 MB.
How do we deal with
conditional
dependencies?
II. Codex: Bundling as a service
What if we generate
on-demand?
Step 1
Build the conditional
dependency graph.
git
git artifact
artifact
artifact
web/v1 web/v2 web/v3 web/v4
Step 2
Evaluate the dynamic inputs.
AB Tests
AB Tests
noun, plural [trooth z, trooths]
A bucket of boolean
flags used to build a
personalized Netflix
experience
{
"webfonts": false,
"instantSearch": true,
"socialFeatures": false,
"motionBanner": true,
"html5video": true,
"customScrollbar": true
}
Step 3
Apply the truths against the
conditional dependency graph.
<script/>
http://codex.nflxext.com/web/v1/home.js/oldSearch,foo
<script/> <script/>
codex
? I got
this!
http://codex.nflxext.com/web/v1/home.js/oldSearch,foo
codex {
oldSearch: true,
foo: true
}
web/v1
http://codex.nflxext.com/web/v1/home.js/oldSearch,foo
http://codex.nflxext.com/{team}/{version}/{entryPoint}/{truths}
oldSearch
foo
bar
{
oldSearch: true,
foo: true
} newSearch
response times <= 70ms
<script/> <script/>
codex
Cached! Here
you go!
http://codex.nflxext.com/web/v1/home.js/oldSearch,foo
III. Scaling for Netflix
web/v1 web/v2 tv/v5 tv/v7
Build
management
1. Where are the
artifacts stored?
2. How do we find
stored artifacts?
Storage Metadata
Codex is mission
critical.
Amazon S3
Storage
Amazon
DynamoDB
Metadata
• Durable
• Reliable
• Scalable
• Available *
• Node.js client
* Except on 2/28/17
Amazon S3
Storage
• NoSQL
• Node.js client
• DynamoDB Streams *
• Available…?
* Didn’t quite work out
DynamoDB
Metadata
Saved!
web/v1
Management service
Saved!
codex
Runtime service
activate
web/v1 web/v1
OK!
Management service
Activate!
Runtime service
codex
Here are all
the active
artifacts!
codex
Runtime service
DynamoDB can’t
keep up!
• Polling works because we
are behind CDN
• Understand partition keys
and partition behavior
• Read the limits and best
practices guidesDynamoDB
Caveats
What about
operational resiliency?
February 28, 2017, was just another day.
Until it wasn’t.
eu-west
us-west
us-east
eu-west
us-west
us-east
Replication has a
lot of caveats.
Amazon S3 can only replicate to one destination.
Amazon S3 can’t replicate transitive objects.
DynamoDB replication isn’t real time.
Every AWS Region is wholly independent!
eu-west
us-west
us-east
codex-sdk
us-east
???
eu-west
us-west
???
???
???
eu-west
us-west
What about
Codex itself?
prod prod-new canary
16 GB ought to be
enough for us! 🙂
codex
400+ artifacts!
…and we ran out of memory.
32 GB ought to be
enough for us!
🤔
800+ artifacts!
…and we ran out of memory.
64 GB ought to be
enough for us…? 😭
1,600+ artifacts!
Our teams will use as
much as we give them.
…and we ran out of memory. Again.
Q: What's cheap,
plentiful, and fast
enough?
A: Disk.
codex
LevelDB
100% CPU usage.
What's the problem?
v8::internal::Runtime_ParseJson~68%
codex
LevelDB
JSON.parse()
JSON.parse is slow.
And blocks the CPU!
codex
LevelDB
JSON.parse()
LRU cache: Saving the CPU
JSON wasn’t done
with us.
RangeError: Invalid string length
It dates back all the way to 2010. Back
then, 512 MB was the overall heap limit,
and I guess it was a no-brainer to decide
that no single string could/should be
bigger than the heap ;-) (512 MB =
memory consumption of a UTF-16 string
with length 2^28.) – jmrk Jun 14 at 15:13
IV. Looking to the future
How do we clean up
old artifacts?
Why not {bundler}?
Don't be afraid to
challenge common
convention.
Don't make
assumptions about
the upper limits.
Don't optimize before you
understand the system.
Use the scientific method:
1. Gather data
2. Formulate hypothesis
3. Test hypothesis
4. Repeat
Engineer for fault tolerance
Netflix scale is
challenging.
https://www.flickr.com/clement127/
https://www.flickr.com/jose_antonio_hidalgo_jimenez/
https://www.flickr.com/reiterlied/
Lego photo credits
Image credits
Image credits
Image credits
Artist: alecive (Alessandro Roncone)
Iconset Homepage: https://github.com/alecive/FlatWoken
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
fin
Alex Liu @stinkydofualiu@netflix.com

Contenu connexe

Tendances

Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
Amazon Web Services Korea
 

Tendances (20)

Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
Trends_of_MLOps_tech_in_business
Trends_of_MLOps_tech_in_businessTrends_of_MLOps_tech_in_business
Trends_of_MLOps_tech_in_business
 
Learning to Rank for Recommender Systems - ACM RecSys 2013 tutorial
Learning to Rank for Recommender Systems -  ACM RecSys 2013 tutorialLearning to Rank for Recommender Systems -  ACM RecSys 2013 tutorial
Learning to Rank for Recommender Systems - ACM RecSys 2013 tutorial
 
Real-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS LambdaReal-time Data Processing Using AWS Lambda
Real-time Data Processing Using AWS Lambda
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
데브시스터즈 데이터 레이크 구축 이야기 : Data Lake architecture case study (박주홍 데이터 분석 및 인프라 팀...
데브시스터즈 데이터 레이크 구축 이야기 : Data Lake architecture case study (박주홍 데이터 분석 및 인프라 팀...데브시스터즈 데이터 레이크 구축 이야기 : Data Lake architecture case study (박주홍 데이터 분석 및 인프라 팀...
데브시스터즈 데이터 레이크 구축 이야기 : Data Lake architecture case study (박주홍 데이터 분석 및 인프라 팀...
 
Advanced Deployment Best Practices with AWS CodeDeploy (DEV404-R2) - AWS re:I...
Advanced Deployment Best Practices with AWS CodeDeploy (DEV404-R2) - AWS re:I...Advanced Deployment Best Practices with AWS CodeDeploy (DEV404-R2) - AWS re:I...
Advanced Deployment Best Practices with AWS CodeDeploy (DEV404-R2) - AWS re:I...
 
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
 
AWSでのビッグデータ分析
AWSでのビッグデータ分析AWSでのビッグデータ分析
AWSでのビッグデータ分析
 
High Performance Data Streaming with Amazon Kinesis: Best Practices (ANT322-R...
High Performance Data Streaming with Amazon Kinesis: Best Practices (ANT322-R...High Performance Data Streaming with Amazon Kinesis: Best Practices (ANT322-R...
High Performance Data Streaming with Amazon Kinesis: Best Practices (ANT322-R...
 
Amazon Aurora: Under the Hood
Amazon Aurora: Under the HoodAmazon Aurora: Under the Hood
Amazon Aurora: Under the Hood
 
Maximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceMaximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performance
 
Introduction to Amazon Aurora
Introduction to Amazon AuroraIntroduction to Amazon Aurora
Introduction to Amazon Aurora
 
AWS Black Belt Online Seminar 2017 Amazon DynamoDB
AWS Black Belt Online Seminar 2017 Amazon DynamoDB AWS Black Belt Online Seminar 2017 Amazon DynamoDB
AWS Black Belt Online Seminar 2017 Amazon DynamoDB
 
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
AWS Storage and Database Architecture Best Practices (DAT203) | AWS re:Invent...
 
AWS Black Belt Techシリーズ Amazon EBS
AWS Black Belt Techシリーズ  Amazon EBSAWS Black Belt Techシリーズ  Amazon EBS
AWS Black Belt Techシリーズ Amazon EBS
 
Past present and future of Recommender Systems: an Industry Perspective
Past present and future of Recommender Systems: an Industry PerspectivePast present and future of Recommender Systems: an Industry Perspective
Past present and future of Recommender Systems: an Industry Perspective
 
Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
Amazon S3 이미지 온디맨드 리사이징을 통한 70% 서버 비용 줄이기 - AWS Summit Seoul 2017
 
Bitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouseBitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouse
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 

Similaire à A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT308 - re:Invent 2017

CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
Chris Anderson
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒
Toki Kanno
 

Similaire à A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT308 - re:Invent 2017 (20)

[JSDC 2016] Codex: Conditional Modules Strike Back
[JSDC 2016] Codex: Conditional Modules Strike Back[JSDC 2016] Codex: Conditional Modules Strike Back
[JSDC 2016] Codex: Conditional Modules Strike Back
 
CouchDB Google
CouchDB GoogleCouchDB Google
CouchDB Google
 
CouchDB - Local Web Platform
CouchDB - Local Web PlatformCouchDB - Local Web Platform
CouchDB - Local Web Platform
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
CMF: a pain in the F @ PHPDay 05-14-2011
CMF: a pain in the F @ PHPDay 05-14-2011CMF: a pain in the F @ PHPDay 05-14-2011
CMF: a pain in the F @ PHPDay 05-14-2011
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 
JS digest. Mid-Summer 2017
JS digest. Mid-Summer 2017JS digest. Mid-Summer 2017
JS digest. Mid-Summer 2017
 
C# Client to Cloud
C# Client to CloudC# Client to Cloud
C# Client to Cloud
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒
 
Rails 101
Rails 101Rails 101
Rails 101
 
Using MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryUsing MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content Repository
 
STP201 Efficiency at Scale - AWS re: Invent 2012
STP201 Efficiency at Scale - AWS re: Invent 2012STP201 Efficiency at Scale - AWS re: Invent 2012
STP201 Efficiency at Scale - AWS re: Invent 2012
 
Backend as a Service
Backend as a ServiceBackend as a Service
Backend as a Service
 
PostgreSQL as seen by Rubyists (Kaigi on Rails 2022)
PostgreSQL as seen by Rubyists (Kaigi on Rails 2022)PostgreSQL as seen by Rubyists (Kaigi on Rails 2022)
PostgreSQL as seen by Rubyists (Kaigi on Rails 2022)
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.js
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
 

Plus de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT308 - re:Invent 2017