Facebook is a popular free social networking website that allows registered users to create profiles, upload photos and video, send messages and keep in touch with friends, family and colleagues.
It includes services such as:
News Feed To expose the users to different contents posted on the network.
Friends To see the list of people you are connected with.
Timeline To allow posting of messages for the user to see while displaying the time and date the message was written.
Comment, Like and Reactions To enable users to easily interact with status updates, comments, photos, videos, advertisement and other.
Notifications To tell the user that something has been added or updated.
Marketplace To allow members to post, read and respond to classified ads.
Groups To allow members who have common interests to find each other and interact.
Events To allow members to publicize an event, invite guests and track plans to attend.
Pages To allow members to create and promote a public page built around a specific topic.
Chat To allow members to see which contacts are online and available to chat with.
It has its own Design Principles like:
Universal To make the entire world more open, and this means reaching every corner, every person. So, the design needs to work for everyone, every culture, every language, every device, every stage of life.
Human Users return to the site to be surrounded by friends and other people near to them. This is a central promise of the product, that the people you care about are all in one place.
Clean The visual style is clean and understated, to create a blank canvas on which the users live. A minimal, well-lit space encourages participation and honest transparent communication.
Consistent The company invests its time wisely by embracing patterns, recognizing that usability is greatly improved when similar parts are expressed in similar ways. The interactions speak to users with a single voice, building trust. Reduce, reuse, don’t redesign.
Useful The product is more utility than entertainment, meant for repeated daily use, providing value efficiently. Therefore, the core interactions, the ones users engage daily, are streamlined, purged of unnecessary clicks and wasted space.
Fast The company values the users time more than their own. They recognize faster experiences are more efficient and feel more effortless. As such, site performance is something the users should never notice. The site should move as fast as they do.
Transparent Users trust the company with their identity, their photos, their thoughts and conversation. They reciprocate it with utmost honesty and transparency. They are clear and up front about what’s happening and why.
Facebook used a configuration management system called ZooKeeper before. It is an open source distributed synchronization service to distribute updates. Its strong consistency and ordering guarantees were critical in allowing to scale and run their systems reliably. But as the infrastructure continues to grow to millions of machines, the system became a bottleneck. When a data znode (ZooKeeper Node) which may contain data or other child znodes is updated, ZooKeeper notifies all interested clients. It can trigger a thundering herd problem as incoming client requests overwhelm ZooKeeper. Its strict ordering guarantees also plays a crucial role. Because of it, it means that writes are always processed in order by a single thread. ZooKeeper then interleaves read and write processing to ensure that reads are not starved. The updates to particular znodes could trigger a large number of watches which in turn could trigger a large number of reads from the clients. A few such writes could result in stalls that block updates.
That is why the Facebook comes up with an idea to design a system for the future. They started designing a new distribution system which satisfies the following:
Support for large updates. Increase the file size from 5MB to 100MB.
Independent data store.
Distribution capacity that can easily support millions of clients.
Limit distribution latency to less than 5 seconds.
Support 10x the number of configuration files as the priority.
Resiliency against thundering herds and spikes in update rates.
This is where the Location-Aware Distribution (LAD) takes place. It consists of two main components that communicate with each other via Thrift RPC. Proxy is a daemon running on every machine that serves configuration files to any interested application. Distributor which fulfills two roles. First, it polls the data store for new updates and second, it constructs a distribution tree for a set of proxies interested in an update.
The figure above displays how LAD organizes proxies into a distribution tree which is a well-organized peer-to-peer network. The proxy sends “subscribe” (S1) request to the distributor. The distributor adds the proxy to the distribution tree by sending an “add peer” request (S2) to its parent. Once the proxy has been added to the tree, it starts receiving metadata (S3) updates. These are filtered, and the proxy responds with content requests (S4). If the parent has the content, it will send it to its child immediately; otherwise, it will download the content from its parent (S5).
To keep with this growth, they also designed the Fabric Aggregator; a distributed network system made up of simple building blocks. Taking a disaggregated approach allows to accommodate larger regions and varied traffic patterns while providing the flexibility to adapt to future growth.
All traffic that leaves or enters Facebook’s data centers is handled by the Fabric Aggregation Layer. Traffic that flows between buildings in a region is referred to as east/west traffic, while traffic exiting and entering a region is known as north/south traffic. A Fabric Aggregator node is a unit of bandwidth that they stamp out to meet the overall bandwidth demand of a particular network tier. They replicate these nodes to meet the overall demand of this aggregation tier. The physical footprint of this unit of bandwidth in terms of space, power and cooling, may or may not fit in a rack. The backplane cabling unit provides the necessary interconnection of the building blocks inside each Fabric Aggregator node.
With all this information gathered, Facebook have concluded that having a separate control and data flow plane enables each distributor to handle around 40,000 subscribers compare to ZooKeeper which handled around 2,500 subscribers only. They have also learned several lessons in building and deploying LAD. These are:
Tooling and monitoring are critical to production deployment. A P2P based system is challenging to operate and debug as it is unclear what nodes are in the sending or receiving path for any given request.
Failure injection and disaster readiness testing is critical at scale. It is useful to run tests and develop strategies to react efficiently when issues arise.
Continuous and regular tests are critical to long-term system reliability. It is not enough to run the tests only once, as things move fast at Facebook and assumptions about systems or tooling may not continue to hold true. They are automating the test processes so that they can exercise their response to failures on a regular basis.
Another thing is that Fabric Aggregator redefines the way they scale the network capacity between data center fabric in different regions. It outlines a unique design and architecture that leverages simple, open and readily available network building blocks to create large scale network solutions. The disaggregated design provides the flexibility, capacity, and speed to address out the current needs and future growth of the company.
Daryll Louise D. Tenorio