Here’s Why Facebook Is So Damn Fast Even With 1.35B Users
Social Media Week is a leading news platform and worldwide conference that curates and shares the best ideas and insights into social media and technology's impact on business, society, and culture.
Access exclusive SMW+ content by marketers whose careers you can emulate with a free 30-day trial!
Each day, 864 million individuals login to Facebook to check their newsfeeds, post status updates, and view photos and videos. According to RedOrbit, users click Facebook’s “Like” button at least 4.5 billion times each day. They send more than 10 million daily messages to one another. And they stream countless hours of video. Since its inception, Facebook has grown to 1.35 billion monthly active users, with a bulk of the growth occurring in the past two years. With traffic growth of up to 60% in just one year, how does Facebook handle this load without increasing the number of servers?
The answers: “Hip Hop for PHP” and “Hip Hop Virtual Machine” – two technologies developed by Facebook to handle 500% more traffic in the same amount of time on its servers, according to a white paper released by the company in 2013. Facebook’s goal is to not only handle traffic more efficiently but to also make the Internet less data intensive so mobile users are not stuck paying hefty data fees. These technologies, together with load balancing, allow Facebook to scale up its server capacity without sacrificing speed.
When Facebook’s web servers are idle and not taking user requests, the servers don’t need much power in order to compute basic functions. As networking traffic increases, the servers use more CPU resources, which means they also need to consume more energy. During relatively quiet periods, Facebook discovered that the servers were consuming more energy than they would if they were simply left idle and that the power required for these low energy periods was essentially the same as medium energy periods.
Image: from Softpedia
Consequently, it is more efficient for Facebook to either have its servers running at medium capacity or to simply sit idle. To put it in simple terms, rather than having 10 servers simultaneously running at low capacity, it makes more sense to consolidate the traffic so that five servers are at medium capacity and five are sitting idle.
According to Gigaom, Facebook uses Autoscale as an intermediary between incoming traffic and the company’s servers. During periods of low network traffic, Autoscale distributes this traffic to a smaller number of servers and keeps these servers running at medium capacity. This leaves the rest of the servers either idle or handling batch-processing tasks, neither of which consume significant energy. At midnight, when the traffic dips, Facebook says that Autoscale reduced energy consumption by 27 percent versus the old method of having all servers run at low capacity. Across the board on a daily basis, Autoscale reduces energy consumption by 10 to 15 percent.
Autoscale and Load Balancing for Small Businesses
Image: licensed from PhotoDune
Businesses do not need to have Facebook’s daily activity levels to benefit from solutions like load balancing. Whether a business’s servers are handling 1.35 billion active monthly users (like Facebook) or 10,000 monthly visitors, load balancing to optimize traffic across servers is a smart and scalable solution. For example, load balancing with “Source IP Hash” is an effective method that evenly distributes traffic across servers.
Requests arriving for a specific IP are consistently routed to the same web server. This optimizes server speed. Should a server failure occur, load balancing will automatically re-route traffic away from that server so your customers and clients are never left staring at blank screen. As soon the server is back online, load balancer will respond and redistribute traffic accordingly.
An even more advanced technology employs layer 7 load balancing solutions that can analyze the incoming traffic, as well as the current capacity of the target server. This ensures smarter data-driven load balancing decisions, thereby un-randomizing the distribution of load (e.g., using Least Pending Request (LPR) algorithm).
With Layer 7 load balancing, load distribution is optimized by assessing the incoming load and directing it to the most available resource, based on information provided in real-time.
Moreover, Layer 7 load balancing also enables session persistence (a.k.a. stickiness) ensuring fluid performance and high availability, even in case of partial server failure and cross-data center distribution.
Your business does not have to be a social media giant to benefit from load balancing. Any server implementation can experience server slowdowns or traffic spikes. In these instances, load balancing will help manage traffic and load to improve access speeds and loading times. Load balancing is efficient, flexible and scalable: as your business’ traffic grows, load balancing solutions will grow with you. If Facebook can manage to handle more than a billion users without a hitch, so should your business.
Write for Us
Interested in sharing your ideas and insights with the world? Become a SMW News contributor and reach 300k readers each month.