惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
V
V2EX
雷峰网
雷峰网
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
F
Full Disclosure
Y
Y Combinator Blog
V
V2EX - 技术
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
SecWiki News
SecWiki News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
量子位
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
K
Kaspersky official blog
B
Blog
A
Arctic Wolf
Hacker News: Ask HN
Hacker News: Ask HN
L
LangChain Blog
T
Tor Project blog
P
Privacy & Cybersecurity Law Blog
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
Lohrmann on Cybersecurity
D
Docker
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
The Last Watchdog
The Last Watchdog
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy International News Feed
Simon Willison's Weblog
Simon Willison's Weblog

博客园 - LeeWenjie

【转发】NPAPI学习(Firefox和Chrome扩展开发 ) 【转发】NPAPI开发详解,Windows版 【转发】网易邮箱前端技术分享之javascript编码规范 【转发】淘宝网架构分享总结 【转发】淘宝网采用什么技术架构来实现网站高负载的 【转发】浅析淘宝网首页信息架构的变迁 【转发】Html5 File Upload with Progress 【转载】使用JavaScript实现Motion Detection 【转发】WEB前端开发规范文档 【转发】响应式Web设计?怎样进行? 【转发】开源中最好的Web开发的资源 【原创】PDA DataGrid的滚动条事件处理 【原创】PDA 实现DataGrid可编辑 【转发】SharePoint 2010——ListData.svc故障排除 【转发】谈论 SharePoint 2010中的沙盒解决方案(Sandboxed Solution) 【原创】NET4.0在SharePoint 2010 IIS下出现导演 C#实现多语言 【转载】互联网产品开发中的“快”字诀 【转载】SHAREPOINT TimeJob定时器开发
【转发】揭秘Facebook 的系统架构
LeeWenjie · 2013-12-05 · via 博客园 - LeeWenjie

揭底Facebook 的系统架构

www.MyException.Cn   发布于:2012-08-28 12:37:01   浏览:0次

揭秘Facebook 的系统架构

 www.MyException.Cn   发布于:2012-08-28 12:37:01 

Facebook是一个社交网路服务网站,同时Facebook是美国排名第一的照片分享站点,每天上载八百五十万张照片。那么Facebook系统架构是什么样的呢?本文将为你揭秘!

来源:http://www.quora.com/What-is-Facebooks-architecture (由Micha?l Figuière回答)

根据我现有的阅读和谈话,我所理解的今天Facebook的架构如下:

◆  Web 前端是由 PHP 写的。Facebook 的 HipHop [1] 会把PHP转成 C++并用 g++编译,这样就可以为模板和Web逻贺业务层提供高的性能。

◆  业务逻辑以Service的形式存在,其使用Thrift [2]。这些Service根据需求的不同由PHP,C++或Java实现(也可以用到了其它的一些语言……)

◆  用Java写的Services没有用到任何一个企业级的应用服务器,但用到了Facebook自己的定制的应用服务器。看上去好像是重新发明轮子,但是这些Services只被暴露给Thrift使用(绝大所数是这样),Tomcat太重量级了,即使是Jetty也可能太过了点,其附加值对Facebook所需要的没有意义。

◆  持久化由MySQL, Memcached [3], Facebook 的 Cassandra [4], Hadoop 的 HBase [5] 完成。Memcached 使用了MySQL的内存Cache。Facebook 工程师承认他们的Cassandra 使用正在减少,因为他们更喜欢HBase,因为它的更简单的一致性模型,以到其MapReduce能力。

◆  离线处理使用Hadoop 和 Hive。

◆  日志,点击,feeds数据使用Scribe [6],把其聚合并存在 HDFS,其使用Scribe-HDFS[7],因而允许使用MapReduce进行扩展分析。

◆  BigPipe [8] 是他们的定制技术,用来加速页面显示。

◆  Varnish Cache [9]用作HTTP代理。他们用这个的原因是高速和有效率。 [10].

◆  用来搞定用户上传的十亿张照片的存储,其由Haystack处理,Facebook自己开发了一个Ad-Hoc存储方案,其主要做了一些低层优化和“仅追加”写技术 [11].

◆  Facebook Messages 使用了自己的架构,其明显地构建在了一个动态集群的基础架构上。业务逻辑和持久化被封装在一个所谓的’Cell’。每个‘Cell’都处理一部分用户,新的‘Cell’可以因为访问热度被添加[12]。持久化归档使用HBase [13]。

◆  Facebook Messages 的搜索引擎由存储在HBase中的一个倒置索引的构建。 [14]

◆  Facebook 搜索引擎实现细节据我所知目前是未知状态。

◆  Typeahead 搜索使用了一个定制的存储和检索逻辑。 [15]

◆  Chat 基于一个Epoll 服务器,这个服务器由Erlang 开发,由Thrift存取 [16]

◆  关于那些供给给上述组件的资源,下面是一些信息和数量,但是有一些是未知的:

◆  Facebook估计有超过60,000 台服务器[16]。他们最新的数据中心在俄勒冈州的Prineville,其基于完全自定设计的硬件[17] 那是最近才公开的 Open Compute 项目[18]。

◆  300 TB 的数据存在 Memcached 中处理 [19]

◆  他们的Hadoop 和 Hive 集群由3000 服务器组成,每台服务器有8个核,32GB的内存,12TB的硬盘,全部有2万4千个CPU的核,96TB内存和36PB的硬盘。 [20]

◆  每天有1000亿的点击量,500亿张照片,100 billion hits per day, 50 billion photos, 3 万亿个对象被 Cache,每天130TB的日志(2010年7月的数据) [21]

参考引用

[1] HipHop for PHP: http://developers.facebook.com/blog/post/358

[2] Thrift: http://thrift.apache.org/

[3] Memcached: http://memcached.org/

[4] Cassandra: http://cassandra.apache.org/

[5] HBase: http://hbase.apache.org/

[6] Scribe: https://github.com/facebook/scribe

[7] Scribe-HDFS: http://hadoopblog.blogspot.com/2009/06/hdfs-scribe-integration.html

[8] BigPipe: http://www.facebook.com/notes/facebook-engineering/bigpipe-pipelining-web-pages-for-high-performance/389414033919

[9] Varnish Cache: http://www.varnish-cache.org/

[10] Facebook goes for Varnish: http://www.varnish-software.com/customers/facebook

[11] Needle in a haystack: efficient storage of billions of photos:http://www.facebook.com/note.php?note_id=76191543919

[12] Scaling the Messages Application Back End:http://www.facebook.com/note.php?note_id=10150148835363920

[13] The Underlying Technology of Messages:https://www.facebook.com/note.php?note_id=454991608919

[14] The Underlying Technology of Messages Tech Talk:http://www.facebook.com/video/video.php?v=690851516105

[15] Facebook’s typeahead search architecture:http://www.facebook.com/video/video.php?v=432864835468

[16] Facebook Chat: http://www.facebook.com/note.php?note_id=14218138919

[17] Who has the most Web Servers?:http://www.datacenterknowledge.com/archives/2009/05/14/whos-got-the-most-web-servers/

[18] Building Efficient Data Centers with the Open Compute Project:http://www.facebook.com/note.php?note_id=10150144039563920

[19] Open Compute Project: http://opencompute.org/

[20] Facebook’s architecture presentation at Devoxx 2010:http://www.devoxx.com

[21] Scaling Facebook to 500 millions users and beyond:http://www.facebook.com/note.php?note_id=409881258919