标签:des style blog http java os io for
Web front-end written in PHP. Facebook‘s HipHop Compiler then converts it to C++ and compiles it using g++, thus providing a high performance templating and Web logic execution layer. Because of the limitations of relying entirely on static compilation, Facebook‘s started to work on a HipHop Interpreter as well as a HipHop Virtual Machine which translate PHP code to HipHop ByteCode.
HipHop for PHP (HPHPc) is a PHP transpiler created by Facebook. By using HPHPc as a source-to-source compiler, PHP code is translated into C++, compiled into a binary and run as an executable, as opposed to the PHP‘s usual execution path of PHP code being transformed into opcodes and interpreted. The original motivation behind HipHop was to save resources on Facebook servers, given the large PHP codebase of facebook.com. Increases in web page generation throughput by factors of up to six have been observed over the Zend PHP.
HipHop Virtual Machine (HHVM), which is a just-in-time (JIT) compilation-based execution engine for PHP, also developed by Facebook. There were many reasons for this;
Business logic is exposed as services using Thrift. The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
Services implemented in Java don‘t use any usual enterprise application server but rather use Facebook‘s custom application server. At first this can look as wheel reinvented but as these services are exposed and consumed only (or mostly) using Thrift, the overhead of Tomcat, or even Jetty, was probably too high with no significant added value for their need.
Persistence is done using MySQL, Memcached, Hadoop‘s HBase. Memcached is used as a cache for MySQL as well as a general purpose cache.
Offline processing is done using Hadoop and Hive.The Apache Hive data warehouse software facilitates querying and managing large datasets residing in distributed storage. Hive provides a mechanism to project structure onto this data and query the data using a SQL-like language called HiveQL. At the same time this language also allows traditional map/reduce programmers to plug in their custom mappers and reducers when it is inconvenient or inefficient to express this logic in HiveQL.
Data such as logging, clicks and feeds transit using Scribe and are aggregating and stored in HDFS using Scribe-HDFS, thus allowing extended analysis using MapReduce. Scribe is a server for aggregating log data streamed in real time from a large number of servers.
BigPipe is their custom technology to accelerate page rendering using a pipelining logic.
Varnish Cache is used for HTTP proxying. They‘ve prefered it for its high performance and efficiency.
The storage of the billions of photos posted by the users is handled by Haystack, an ad-hoc storage solution developed by Facebook which brings low level optimizations and append-only writes.
Facebook Messages is using its own architecture which is notably based on infrastructure sharding and dynamic cluster management. Business logic and persistence is encapsulated in so-called ‘Cell‘. Each Cell handles a part of users ; new Cells can be added as popularity grows. Persistence is achieved using HBase.
Facebook Messages‘ search engine is built with an inverted index stored in HBase. Link
The typeahead search uses a custom storage and retrieval logic. Link
Chat is based on an Epoll server developed in Erlang and accessed using Thrift. Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang‘s runtime system has built-in support for concurrency, distribution and fault tolerance.
They‘ve built an automated system that respond to monitoring alert by launching the appropriated repairing workflow, or escalating to humans if the outage couldn‘t be overcome.
About the resources provisioned for each of these components, some information and numbers are known:
facebook architecture,布布扣,bubuko.com
标签:des style blog http java os io for
原文地址:http://www.cnblogs.com/linyx/p/3897917.html