Asynchronous computing @Facebook: Driving efficiency and developer productivity at Facebook scale

People use our apps and services every day for a wide spectrum of use cases, including sharing pictures; following the latest news and sports updates; sharing life-changing events, such as the birt…

Carla Souza
13 min readintermediate
--
View Original

Overview

The article discusses Facebook's implementation of asynchronous computing to enhance efficiency and developer productivity at scale. It outlines the evolution of the Async system, addressing challenges in request management, prioritization, capacity optimization, and the introduction of new solutions to handle billions of requests effectively.

What You'll Learn

1

How to prioritize asynchronous requests based on delay tolerance

2

Why multitenant architecture is essential for scaling services

3

How to optimize server capacity using queueing, time shifting, and batching

Prerequisites & Requirements

  • Understanding of asynchronous computing concepts
  • Experience with high-traffic web applications(optional)

Key Questions Answered

How does Facebook manage billions of asynchronous requests?
Facebook manages billions of asynchronous requests by implementing a multitenant architecture that allows shared server resources across various use cases. This system prioritizes requests based on urgency and optimizes capacity through techniques like queueing, time shifting, and batching to ensure efficient processing during peak and off-peak hours.
What are the main challenges of scaling asynchronous systems?
The main challenges include managing high volumes of requests, ensuring fair resource allocation among different use cases, and maintaining system reliability despite bugs or misconfigurations. Facebook addresses these challenges by introducing policies for capacity regulation and prioritization based on delay tolerance.
What is delay tolerance in asynchronous requests?
Delay tolerance refers to the maximum time a request can be delayed before it must be executed. By understanding the delay tolerance of various requests, Facebook can prioritize them effectively, ensuring that time-sensitive notifications are processed promptly while less urgent tasks can wait.
How does batching improve system performance?
Batching improves system performance by aggregating multiple jobs into a single request, which reduces the load on the Async service. This method minimizes the number of round-trips between the dispatcher and worker, leading to more efficient processing, especially during peak traffic times.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Implement a multitenant architecture to optimize resource sharing across different services.
This approach allows for better utilization of server capacity and helps manage varying traffic patterns, making it essential for scaling applications effectively.
2
Utilize delay tolerance to prioritize requests based on their urgency.
By categorizing requests according to how long they can be delayed, you can ensure that critical notifications are processed first, improving user experience during peak usage.
3
Adopt batching techniques to reduce load during high traffic events.
Batching multiple jobs into a single request can alleviate pressure on system components, leading to improved performance and efficiency during major events.

Common Pitfalls

1
Overloading the system with too many concurrent requests can lead to performance degradation.
This often happens when there is a lack of capacity regulation, causing some requests to stall and others to be delayed. Implementing quotas and rate limiting can help mitigate this issue.

Related Concepts

Asynchronous Computing
Multitenant Architecture
Request Prioritization
Capacity Optimization Techniques