Facebook is aroundEstablished in 2004, With gradually becomingThe five major US technology giantsOne of their infrastructure also by the university bedroom in a server developed into a globalSevenCustomize the data center. With Facebook expect the number of users will grow to 1.94 billion, they are likely to still plan a new data center.
Recently announced a message: Snap and withGoogle Cloud PlatformwithAWS(Amazon Web Services) signedWorth $ 2 billion and $ 1 billion in orders, Which makes us curious, to Facebook so large scale, can run on top of AWS.
In order to answer this question, we consider from four aspects:
Please note that we are not considering whether Facebook should migrate to AWS, just to explore the feasibility of doing so.
1. server capacity
Since Facebook has not been published for a long time the number of accurate servers, many people based on the spread of the assumptions to further speculation. But here sure a lot of water.
How many servers are there in the end?
As early as 2012, Data Center Knowledge estimated Facebook180,000 serversThe This value is based on a set of data released in 2010 through this set of dataAccurate calculationLearned that Facebook in 2010 a total of 60,000 servers. Assuming the 2012 valuation is accurate, then the number of Facebook server growth has been far more than theMoore's LawThe
Facebook user growth, source:The Next Web
We want to know how many servers are available today after five years (2012-2017). In order to obtain as accurate a valuation as possible, we made three calculations.
Calculate the number of users per server
First through the "server number per server" to calculate the number of Facebook server.
In 2012, Facebook users 1 billion, a total of 180,000 servers.
2017, Facebook users close to 2 billion.
In addition also need to consider, Facebook not only doubled the number of users, the amount of data generated by each person also increased: photos, video, live and so on. In addition, Facebook is still running Instagram, then the number of servers and then double it.
360,000 * 2 = 720,000 servers
According to this calculation, Facebook in 2017 the number of servers is about 72 million units.
Calculate two: revenue per server
Then through the "revenue per server" to calculate their server capacity.
In 2012, Facebook revenue for the$ 8.9 billionThe The 2012 revenue divided by the total number of servers in 2012, then the server revenue of 28,000 US dollars.
In 2016, Facebook revenue of 27.638 billion US dollars, divided by 28,272 US dollars, then it is 977,575 servers.
According to this calculation, Facebook in 2017 the number of servers is about 978,000 units.
Calculate the number of employees per server
This method will use the number of employees to calculate the server capacity.
2012, Facebook has4,619 employees, An average of about 40 employees per employee.
In 2016, Facebook had 17,048 employees. According to each employee 40 servers to calculate, about 681,920 servers.
According to this calculation, Facebook in 2017 the number of servers is about 68.2 million units.
Differences between the number of different
The interval for the three calculations is 296,000.
978,000 - 682,000 = 296,000
Take the median and use it as our final number.
296,000 / 2 = 148,000
682,000 + 148,000 = 830,000 or 978,000 - 148,000 = 830,000
So we estimate that Facebook in 2017 a total of 830,000 servers.
AWS how many servers?
AWS Global Infrastructure, Source: AWS
AWS can be broken down as follows:
As of 2017, AWS total:
Related information can be foundAWS Global InfrastructureIntroduction.
Assuming an average of 65,000 servers per data center, with an average of 1.5 data centers per AZ, the total number of servers is 4.095 million units. Rounded down, assuming that AWS has a total of 4.1 million servers.
(42 AZ * 1.5 data centers) * 65,000 servers = 4,095,000
In 2014, Enterprise Tech went onSimilar calculations(But based on 28 AZ, but the truth is the same), the final estimate of the number of servers between 2.8 million to 5.6 million units. In their estimates, each AZ contains three data centers, and if this assumption is accurate, AWS may have more than 8 million servers worldwide.
Server net capacity
In the server net capacity, according to the above (may not be accurate) calculation, AWS Facebook is 5 times the scale.
Supplementary Note: The above calculations do not take into account the current capacity limitations of AWS. How much capacity does AWS have for daily operations? Does AWS have 20% of reserved capacity that can be allocated to Facebook? We intend to ignore these issues, directly assume that AWS can fully accommodate Facebook's current needs, but may have to sacrifice flexibility as a price.
In order to meet future server needs, Facebook and AWS are in the server infrastructure for continuous investment, so you can think that the future of AWS is also sufficient to carry the future of Facebook.
In the server net capacity, Facebook may be hosted on the AWS?
It may be possible.
2. Server hardware performance
Can not be directly assumed that AWS and Facebook server performance is equal, so also consider the server performance problems. Facebook has invested billions of dollars in server infrastructure, and as the scale grows, they go through a laptop as a server, rent servers from third parties, and build their own data centers. When they start designing and building their own data centers, the unpacking solution is no longer suitable.
Facebook Fort Worth Data Center, Source: DataCenter Knowledge
Facebook seven data centers in all aspects to maximize performance and efficiency for the design goals. From the overall design of the data center to a variety of details, such as server racks and chips, everything is custom.
"In order to optimize the cost, we eliminated most of the components you can see on a standard server," said Amir Michael, the designer of the Facebook server.Year 2009This is said.
"We removed all the useless things, only to keep the most necessary." & Rdquo;
2011, FacebookOpen sourceTheir own data center and the server all the design, to express the love of high efficiency design. Then many people contributed to the project, including Google. These initiatives have also contributed to further reductions in hardware costs, starting with third-party manufacturers to produce components that further reduce the cost of building a customized data center. You can visitData Center KnowledgeView the full list of Facebook server hardware.
So Facebook's existing server infrastructure has been greatly optimized to help Facebook as efficiently as possible. For example, they in the server field opened up a separate "ldquo;Cold storage& Rdquo ;, specifically used to save photos and videos that are no longer viewed (usually uploaded to Facebook 10 years ago). Only when someone wants to view these photos or videos, will "wake up" this kind of storage device.
This YouTubevideoShow Facebook's cold storage settings.
Facebook for many years of specialization operations and AWS is very different, AWS storage design in the need to consider the use of different purposes (high load). But similar to Facebook and Google, AmazonAlso design their own hardwareThe
"Yes, we will make our own server," Amazon CTOWerner VogelsSaid: "We will meet the needs of these (heavyweights) workloads through customizable custom storage and servers. We also work with Intel to make it higherClock frequencyRun the processor for use. & Rdquo;
Although AWS may seem more generalized, but their actual performance of the server can not be worse than the Facebook. However, on the specialization and efficiency, we have a lot of different views, these large technology companies why do this? Assuming really want to migrate, in order to be able to get through AWS with their own data center similar performance, Facebook is likely to need more servers. In order to reflect this factor, and in the absence of actual data in the case of comparison, we assume that Facebook will need to migrate the number of servers than the current increase of 10%, so the number of servers will increase to 91.3 million units.
830,000 * 1.1 = 913,000
Facebook within the Prineville data center, Source: DataCenter Knowledge
Also note that Facebook is planningMove WhatsApp out of the IBM platform, Move to your own server to run. WhatsApp currently uses 700 bare metal (similar to Facebook) high-end IBM SoftLayer server, these servers can basically provide similar performance with Facebook's own hardware. But this figure (700!) Is insignificant compared to what we discussed before, and it can be assumed that future growth in this area can be included in their future expansion plans.
In reality, Facebook is completely impossible to migrate to AWS. So the process of opening the hole does not take into account the specific process of migration, we just want to explore the feasibility of doing so. In fact, the full text of this article is based on a hypothesis: Facebook from the beginning of the first day of self-built infrastructure to choose to host in the AWS, the results will be what.
And assuming that we are in a parallel universe, how long does it take to move to AWS? Facebook moved Instagram from AWS to its own server between 2013 and 2014, the whole process took a year, andNo one noticedThe In conjunction with this matter, we should also be able to reverse the migration without enduring the end user.
However, we want to migrate, but the whole Facebook, including Instagram, so the whole process will take longer. Compared to this theoretical shift, Instagram's migration scale is much smaller, and there is no need to say that the size of Instagram before the migration has also expanded a lot. Also do not forget that Netflix, they spentEight yearsOnly to move to AWS. Eight years!
Based on these assumptions and guesses, the migration process should be smooth, but it may take years to complete.
Server hardware performance
AWS and Facebook have invested heavily in custom data centers, server design, and implementation. In the case of all designs are open source, the two server performance is likely to be comparable.
We think that AWS can easily provide the computing power and performance required by Facebook. But because AWS can not meet some of the special needs of Facebook, so also need to retain some margin. Facebook with 830,000 own server can do things, replaced by AWS server may need 913,000 units.
Can AWS provide the server performance required by Facebook?
There is absolutely no problem.
Facebook has (and is still) using OSS (open source software) for development. Similar to other companies, their growth is fast, in such a large scale, usually need to develop their own custom tools, or a large number of existing tools to meet their own needs.
They still use PHP to develop application code, but in order to improve performance, Facebook developedHipHop Virtual Machine(HHVM) To compile PHP code in real time (JIT). This means that Facebook's code can be run by using HHVM and nginx.Facebook's entire website runs on top of HHVM(Desktop, API, mobile), development and production environments are true. And that's exactly the customization of the software.
Feeling, AWSThe relationship with PHP and HHVM is worryingThe But on Facebook's ownHHVM GitHub Code Library, There is a link to the pointHHVM for AWS Linux serverThe So we can assume that Facebook can successfully run HHVM on AWS and run its own website.
But the database? Data storageSQL vs. NoSQLThere is a notorious example: Facebook rightMySQLMade a drastic change, used to store their owntimelineData, while relying onMemcachedTo achieve rapid delivery. About Facebook stretching, it is recommended to readHigh ScalabilityRelated articles. Facebook customization MySQL specification can be foundHereThe
Amazon RDS(Relational Database Service) to meet the requirements? There are many technology giants are using Amazon RDS, the most famous is Netflix. It may be argued that if Netflix and all of their company's videos can be successfully run through RDS, then Facebook can also? The answer can not be determined, but Facebook's MySQL cluster is extremely large, simply migrating is likely to simply can not meet the demand. In order to handle their own load, they even created their own MySQL branch!
At present Facebook has also constructed a very comprehensiveTechnology stackThe TheirGitHub codebaseEnough to prove this. This can not help but worry more about their infrastructure and AWS compatibility issues.
This process in the end how difficult,NetflixThe example may be the best proof that with the migration to the distributed cloud environment, they need to rebuild most of the technical components.
AWS can support Facebook's huge software environment and complex data needs?
Maybe, but it is almost certain that this will make the performance greatly affected, and Facebook may even need to build a new system.
4. How will the cost of hosting a Facebook to AWS?
Note: This may be the worst content of this article. While AWS provides a wealth of costing methods, we can not be aware of Facebook's actual demand for data storage and computing. Again, these data are based entirely on guessing.
We are curious about the last question: cost. While AWS has helped countless companies to scale down quickly and costually, most of them will never be able to reach Facebook's size. The size of Facebook, self-built infrastructure may be cheaper (they also do so, but we just want to open a brain hole ^.
In useAWS own cost calculatorBefore the calculation, first look at some of the globalization of products in the cloud computing costs.
Snapchat's IPO file mentions that Snap plans to move in five yearsGooglePay $ 2 billion while at the same timeAWSPay $ 1 billion. That is, $ 50 million per month. So huge numbers so that the technology sector some surprise, and even some people out of the "high cost of storage and deal with the content will soon be destroyed" such a paragraph (Annotation: Snapchat is a & ldquo; ; Application, user sent text and pictures and other content will be removed immediately after the recipient view).
As mentioned above, WhatsApp is still hosted on IBM's public cloud server, but Facebook plans to migrate as soon as possible. However, the current hosting costs of whatsApp are still as high as $ 2 million per month. For an application that uses only 700 servers, the cost is a bit high.
We can assume that Facebook's demand is much higher than WhatsApp and Snapchat's total.
The following calculations are simpler, based on 1,000,000 servers running EC2 calculations, Amazon S3, Amazon RDS, and data and video and other data storage and transmission tasks, the monthly transmission of data traffic 1,256.5PB (1,256,500TB).
In the calculation,
These calculations are not precise nor rigorous. If you have a better way to calculate, welcome yourself try! The original AWS cost calculation results can be foundHereThe
Then start counting:
Calculate: Amazon EC2 instance (used to run PHP code and other content)
Store (photo and video)
Amazon RDS On-Demand DB instance (used to run Facebook's timeline)
Theoretically, if hosted on AWS, Facebook costs $ 5.97 billion a year.
yearRevenueMore than 28 billion US dollars, the total market value of 434 billion US dollars, the global number of users more than 1.94 billion Facebook is undoubtedly a large and complex infrastructure. Facebook is expected in 2012 when its own server infrastructure value has been as high as $ 4 billion, the current figure is likely to have tripled to 12 billion US dollars.
But the annual $ 5.97 billion in hosting costs have been far more than Facebook in 2017 when the revenue costs & rdquo;$ 3,789,000,000), Which already includes data centers and other operating costs.
Also note that the estimated AWS price may not be paid by Facebook. Similar to Snapchat and Netflix, Facebook is also a heavily influential heavyweight user, so it has the ability to negotiate and get a lower price.
Can Facebook pay AWS hosting fees?
Yes, but it's more expensive.
Is it possible for Facebook to host on AWS?
We can never know whether the assumption of this open hole is accurate, but it can be seen:
There is no doubt that these conclusions are wrong, because we can not get the required data for the calculation. But & hellip; & hellip;
According to the calculations and results obtained in this article, can theoretically host Facebook to AWS? Yes, it can be.