630 likes | 746 Vues
An Analysis of Facebook Photo Caching. Qi Huang , Ken Birman, Robbert van Renesse (Cornell), Wyatt Lloyd (Princeton, Facebook), Sanjeev Kumar, Harry C. Li (Facebook). 250 Billion * Photos on Facebook. Profile. Cache Layers. Feed. Full-stack Study. Album. Storage Backend.
E N D
An Analysis ofFacebook Photo Caching Qi Huang, Ken Birman, Robbert van Renesse (Cornell), Wyatt Lloyd (Princeton, Facebook), Sanjeev Kumar, Harry C. Li (Facebook)
250 Billion* Photos on Facebook Profile Cache Layers Feed • Full-stack • Study Album Storage Backend * Internet.org, Sept., 2013
Preview of Results Current Stack Performance • Browser cache is important (reduces 65+% request ) • Photo popularity distribution shifts across layers • Opportunities for Improvement • Smarter algorithms can do much better (S4LRU) • Collaborative geo-distributed cache worth trying
Facebook Photo-Serving Stack Client
Client-based Browser Cache Client Client Browser Cache Local Fetch
Client-based Browser Cache Client Client Browser Cache (Millions)
Stack Choice Client Facebook Stack Akamai Browser Cache Caches Storage (Millions) Content Distribution Network (CDN) Focus: Facebook stack
Geo-distributed Edge Cache (FIFO) Client PoP Browser Cache Edge Cache (Millions) (Tens)
Geo-distributed Edge Cache (FIFO) Client PoP Browser Cache Edge Cache (Millions) (Tens) Purpose Reduce cross-country latency Reduce Data Center bandwidth
Geo-distributed Edge Cache (FIFO) Client PoP Browser Cache Edge Cache (Millions) (Tens)
Geo-distributed Edge Cache (FIFO) Client PoP Browser Cache Edge Cache (Millions) (Tens)
Single Global Origin Cache (FIFO) Client Data Center PoP Browser Cache Edge Cache Origin Cache (Millions) (Tens) (Four)
Single Global Origin Cache (FIFO) Client Data Center PoP Browser Cache Edge Cache Origin Cache (Millions) (Tens) (Four) Purpose Minimize I/O-bound operations
Single Global Origin Cache (FIFO) Client Data Center PoP Browser Cache Edge Cache Origin Cache (Millions) (Tens) (Four) Hash(url)
Single Global Origin Cache (FIFO) Client Data Center PoP Browser Cache Edge Cache Origin Cache (Millions) (Tens) (Four)
HaystackBackend Client Data Center PoP Browser Cache Edge Cache Origin Cache Backend (Haystack) (Millions) (Tens) (Four)
Trace Collection Client Data Center PoP • Request-based: collect X% of requests • Object-based: collect reqs for X% objects Instrumentation Scope Browser Cache Edge Cache Origin Cache Backend (Haystack) • (Object-based sampling)
Sampling on Power-law Object rank
Sampling on Power-law Req-based Object rank Req-based: bias on popular content, inflate cache perf
Sampling on Power-law Object-based Object rank Object-based: fair coverage of unpopular content
Sampling on Power-law Object-based Object rank Object-based: fair coverage of unpopular content
Trace Collection Client Data Center PoP Instrumentation Scope Browser Cache Edge Cache Origin Cache Backend (Haystack) R Resizer 1.4M photos, allreqs for each 2.6M photo objects, allreqs for each 77.2M reqs (Desktop) 12.3M Browsers 12.3K Servers
Analysis • Traffic sheltering effects of caches • Photo popularity distribution • Size, algorithm, collaborative Edge • In paper • Stack performance as a function of photo age • Stack performance as a function of social connectivity • Geographical traffic flow
Traffic Sheltering Client Data Center PoP Browser Cache Edge Cache Origin Cache Backend (Haystack) R 77.2M 26.6M 65.5% 11.2M 58.0% 7.6M 31.8% 9.9% 65.5% 20.0% 4.6% Traffic Share
Popularity Distribution • Browserresembles a power-law distribution 2%
Popularity Distribution • “Viral” photos becomes the head for Edge
Popularity Distribution • Skewness is reducedafter layers of cache
Popularity Distribution • Backendresembles a stretched exponential dist.
Popularity with Absolute Traffic • Storage/cache designers: pick a layer
Popularity Impact on Caches High M Low Lowest Each has 25% requests
Popularity Impact on Caches • Browser traffic share decreases gradually
Popularity Impact on Caches 22~23% • Edge serves consistent share except for the tail 7.8%
Popularity Impact on Caches • Origin contributes most for “low”group 9.3%
Popularity Impact on Caches • Backend serves the tail 70% Haystack
Simulation • Replay the trace (25% warm up) • Estimate the base cache size • Evaluate two hit-ratios (object-wise, byte-wise)
Edge Cache with Different Sizes 59% • Picked San Jose edge (high traffic, median hit ratio)
Edge Cache with Different Sizes 65% 68% 59% • “x” estimates current deployment size (59% hit ratio)
Edge Cache with Different Sizes Infinite Cache 65% 68% 59% • “Infinite” size ratio needs 45x of current capacity
Edge Cache with Different Algos Infinite Cache • Both LRU and LFU outperforms FIFO slightly
S4LRU Cache Space L3 L2 L1 L0 More Recent
S4LRU Cache Space L3 L2 L1 L0 More Recent Missed Object
S4LRU Cache Space L3 L2 L1 L0 Hit More Recent
S4LRU Cache Space Evict L3 L2 L1 L0 More Recent
Edge Cache with Different Algos Infinite Cache 1/3x 68% 59% • S4LRU improves the most
Edge Cache with Different Algos Infinite Cache • Clairvoyant (Bélády)shows much improvement space
Origin Cache Infinite Cache 14% • S4LRU improves Origin more than Edge
Which Photo to Cache • Recency & frequency leads S4LRU • Does age, social factors also play a role?