Scaling of Uber’s API gateway

Abhishek Parwal, Karthik Karuppaiya
17 min readadvanced
--
View Original

Overview

The article discusses the scaling of Uber's API Gateway, focusing on the critical components of configuration management and runtime. It highlights the challenges faced in code generation and integration testing, and the solutions implemented to improve developer velocity and system reliability.

What You'll Learn

1

How to optimize code generation times in large-scale systems

2

Why managing code merge conflicts is crucial for development velocity

3

When to implement a differentiated pipeline for UI and manual diffs

4

How to utilize incremental builds for faster deployment

Prerequisites & Requirements

  • Understanding of API Gateway architecture and code generation processes
  • Experience with CI/CD pipelines and code review tools(optional)

Key Questions Answered

What are the main challenges faced in scaling Uber's API Gateway?
The main challenges include large code generation times, integration test delays, code merge conflicts, and managing a large codebase. These issues can significantly slow down development and deployment processes, necessitating effective strategies to address them.
How does Uber optimize its code build pipeline?
Uber optimizes its code build pipeline by implementing differentiated pipelines for UI and manual diffs, using incremental builds, and parallelizing code generation processes. This allows for faster testing and deployment of changes, improving overall developer efficiency.
What is the impact of configuration management on Uber's API Gateway?
Configuration management is critical as it ensures that developers can easily configure their endpoints while maintaining backward compatibility. This directly affects the developer experience and the velocity of feature development, impacting Uber's bottom line.
When should selective module building be applied in code generation?
Selective module building should be applied when only specific endpoints are being changed, allowing for faster builds by reducing the amount of code that needs to be compiled. This is particularly useful in large systems with many endpoints.

Key Statistics & Figures

Code generation time
over 2 hours
This was the time taken for code generation as the number of endpoints increased, which was not scalable.
Code landing success rate
dropped from 90% to 40%
This decline was due to increased merge conflicts as more teams began using the platform.
Codebase size reduction
more than 50%
This was achieved by using trimmed IDL specs instead of the entire set of Thrift IDLs.

Technologies & Tools

Backend
Zanzibar
Used for generating runnable artifacts from configuration files in the Edge Gateway.
Data Serialization
Thrift
Utilized for defining data types and service interfaces in the API Gateway.
Data Serialization
Easyjson
Originally used for JSON serialization, later replaced with JSON-Iter for better performance.
Build System
Bazel
Planned for integration to utilize remote caching for faster builds.

Key Actionable Insights

1
Implement a differentiated pipeline for UI and manual diffs to streamline development processes.
This approach allows for faster testing and deployment of changes, reducing bottlenecks caused by lengthy integration tests and code generation times.
2
Utilize incremental builds to minimize build times and improve deployment efficiency.
By only building what has changed, teams can significantly reduce the time taken to deploy new features, enhancing overall productivity.
3
Regularly clean up unused endpoints and Git history to maintain a manageable codebase.
This practice helps prevent unnecessary complexity and reduces the likelihood of merge conflicts, ensuring smoother collaboration among developers.

Common Pitfalls

1
Failing to manage code merge conflicts effectively can lead to significant delays in development.
This often occurs when multiple developers are working on the same endpoints, causing integration issues that can slow down the entire team.
2
Neglecting to clean up unused endpoints and Git history can complicate the codebase.
Over time, this accumulation can lead to larger diffs and increased complexity, making it harder for developers to navigate and maintain the code.

Related Concepts

API Gateway Architecture
Code Generation Processes
CI/CD Best Practices