a day in the life of a facebook photo€¦ · front-end http post thrift http post resize &...

14

Upload: others

Post on 27-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world
Page 2: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

A Day in the Life ofa Facebook Photo

Brian CabralDirector of Engineering

Page 3: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

2 Billionphotos shared daily

daily users

968 million

Page 4: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

100s of different devices

1,000s of locales/connection types

Page 5: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Massive distributed system

Requiring on-the-fly resizing and transcoding

Page 6: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Basic architecturePhoto Upload

Everstore

PHP Front-end

HTTP post

Thrift

HTTP post

Resize &

Transcode

Page 7: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Resizing

On upload we target 960 or 2048 • function of input size & expected output resolutions

Custom resizing reconstruction filter • Type of separable Lanzcos filter • Designed for speed & quality

Resizing re-transcode

Page 8: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Transcoding

We use PJPEG with custom tables

Extensive internal analysis showed that for most images PJPEG was hard to beat

Page 9: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Everstore

NFS

Fil

er

Ch

eap

FS

Hay

stac

k

HD

FS-

Bas

ed

Exte

rnal

Ven

do

r?

Mechanic+Controller

Photo LB

Photo upload

Video LB

Video upload

Video encode

Verifieddownloads

AkamaiCDN

Download LB

Edge Cache

Origin Cache

Imageprocessing

(FB Algo)Router

Photo product(on www)

URL Generation

Everstore API

Page 10: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Basic architecturePhoto Download

OriginCache

Edge

Resize &Transcode

FCDN

Everstore

HTTP get Thrift

Page 11: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

CDN CachingHaystack:

Distributed File Store

Proxygen: Layer 7

Balancer

BigCache: RAM + Flash

Cache Akamai

Facebook Data Centers

Edge Network dozens of PoPs around the world

Proxygen: Layer 7

Balancer

BigCache: RAM + Flash

Cache

Page 12: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

System design & development

Continuous design & developmentControlled rolloutsExtensive instrumentation

• Big spec, design, … waterfall • Extensive QA testing

Page 13: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world

Open questions

Can we do better than PJEG?

Can we eliminate intermediate processing?

Is there a way to arbitrarily deliver

different sizes and quality?

Can we use image specific caching

schemes?

Can we use ML to dynamically load

adapt?How do GPUs and CPUs aggregate in the

“large?”

Page 14: A Day in the Life of a Facebook Photo€¦ · Front-end HTTP post Thrift HTTP post Resize & Transcode. Resizing ... Facebook Data Centers Edge Network dozens of PoPs around the world