{"id":847,"date":"2008-06-25T22:52:46","date_gmt":"2008-06-26T03:52:46","guid":{"rendered":"http:\/\/www.bytebot.net\/blog\/?p=847"},"modified":"2008-06-25T22:52:46","modified_gmt":"2008-06-26T03:52:46","slug":"how-facebook-serves-pictures","status":"publish","type":"post","link":"https:\/\/www.bytebot.net\/blog\/archives\/2008\/06\/25\/how-facebook-serves-pictures","title":{"rendered":"How Facebook serves pictures"},"content":{"rendered":"<p>I caught <a href=\"http:\/\/static.flowgram.com\/p2.html#2qi3k8eicrfgkv\">Facebook &#8211; Needle in a Haystack: Efficient Storage of Billions of Photos<\/a> on Flowgram. First up, I&#8217;m not a big fan of Flowgrams &#8211; the format is sensible, slide and voice, is excellent, but the delivery in a web browser isn&#8217;t optimal&#8230; make downloadable videos!<\/p>\n<p>The talk however, was excellent. Do watch it, and learn a bit more about Facebook&#8217;s infrastructure. Anyway, some notes I took from the talk:<\/p>\n<ul>\n<li>&#8220;We&#8217;re one of the largest MySQL installations in the world&#8221;<\/li>\n<li>Use memcache &#8211; &#8220;We have memcache because databases aren&#8217;t fast&#8221; (later on in the questions)<\/li>\n<li>Separate team focusing on APE (Apache, PHP and Extensions that they work on)<\/li>\n<li>6.5 billion total images, 4-5 sizes stored for each, so 30 billion files, of about 540TB total&#8230; During peak? 475,000 images served per second, and growing by 100 million uploads per week<\/li>\n<li>Images are usually pulled from a Content Delivery Network (CDN), so it reduces the request rate on their servers<\/li>\n<li>They use NetApp Storage, but basically their upload servers speak NFS to write to NetApp.<\/li>\n<li>Cachr (evhttp based) and File Handle Cache use memcache as a backing store&#8230; FHC is based on lighttpd!<\/li>\n<li>Makes use of a &#8220;haystack&#8221; &#8211; user-level abstraction, storing a separate index file that has more efficient metadata (to reduce disk seeks &#8211; 1 disk seek or less for any workload). Pretty deep in the discussion of the haystack server architecture, also evhttp-based<\/li>\n<li>MySQL use? Very few transactions, very few joins<\/li>\n<li>Video is a very different beast, and the design is a little different<\/li>\n<\/ul>\n<p>If you&#8217;re into information about photo storage sites, don&#8217;t hesitate to also read my previous <a href=\"https:\/\/www.bytebot.net\/blog\/archives\/2007\/04\/25\/federation-at-flickr-a-tour-of-the-flickr-architecture\">notes on Flickr<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I caught Facebook &#8211; Needle in a Haystack: Efficient Storage of Billions of Photos on Flowgram. First up, I&#8217;m not a big fan of Flowgrams &#8211; the format is sensible, slide and voice, is excellent, but the delivery in a web browser isn&#8217;t optimal&#8230; make downloadable videos! The talk however, was excellent. Do watch it, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[23],"tags":[300,297,301,299,298,1775],"class_list":["post-847","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-cache","tag-facebook","tag-flowgram","tag-haystack","tag-memcache","tag-mysql"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p4vJD-dF","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/comments?post=847"}],"version-history":[{"count":0,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/847\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/media?parent=847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/categories?post=847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/tags?post=847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}