# Rebalancer

> Source: https://aiwiki.ai/wiki/rebalancer
> Updated: 2026-10-11
> Fact-checked: 2026-10-11
> Categories: AI Infrastructure, Algorithms, Developer Tools
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "Rebalancer." aiwiki.ai, 11 Oct 2026. https://aiwiki.ai/wiki/rebalancer
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

Rebalancer is a resource-allocation library developed at Meta for assigning objects to containers under constraints and optimization goals. Its C++ core runs in one process with multiple threads; applications can use C++ or Python interfaces.[2] Meta announced its open-source release on September 21, 2026, after more than nine years of internal use.[1]

## Modeling an assignment

The model describes what can be placed, where it can go, and the properties relevant to placement. The same task-to-server problem can express limits on individual servers and requirements across racks.[3]

| Construct | Meaning | Task-placement example |
|---|---|---|
| Object | Item being assigned | Task |
| Container, also called a bin | Assignment destination | Server |
| Dimension | Numeric object or container property | Task CPU requirement or server CPU capacity |
| Scope | Grouping of containers | Servers belonging to a rack |
| Partition | Grouping of objects | Tasks belonging to jobs |

Dimensions can depend on both the object and its destination. Object groups need not be disjoint.[3]

## Goals and constraints

Reusable specifications, or specs, describe placement requirements and quantities to optimize. The reference catalog contains more than 25 specs. Some support both goals and constraints; others support only one.[4]

| Spec | Example purpose | Supported role |
|---|---|---|
| Capacity | Keep utilization within limits | Both |
| GroupCount | Bound a group's utilization within each scope item | Both |
| Balance | Equalize utilization across scope items | Goal |
| AvoidAssignments | Exclude particular placements | Constraint |
| ToFree | Drain listed containers | Both |
| DisasterRecoveryCapacity | Reserve capacity for correlated failures | Both |

A constraint's policy matters when the initial assignment is invalid.[5]

| Policy | Treatment |
|---|---|
| DEFAULT | Preserve initially satisfied constraints. Repair existing violations as high-priority goals while prohibiting deterioration beyond their initial level. |
| HARD | Require satisfaction; inability to satisfy the constraint is an error. |
| SOFT | Penalize violations, which can remain or worsen when the overall objective improves. |

Multiple goals can share a weighted sum or occupy ordered priority buckets. Buckets are compared lexicographically: a lower-priority goal can improve only when earlier buckets tie. A large weight alone does not establish strict priority.[6]

## Expression graph and solvers

Rebalancer translates specifications into a directed acyclic expression graph. The OSDI 2024 paper describes a representation that grows with objects plus bins, rather than the object-bin product of a direct mixed-integer formulation. The graph separates problem representation from the choice of solving algorithm.[7]

| Solver family | Approach | Important limitation |
|---|---|---|
| Local search | Improve an initial assignment through incremental moves | Can stop at a local optimum rather than the best possible assignment |
| Optimal solver | Translate the model for FICO Xpress, Gurobi, or open-source HiGHS | Large problems can exhaust resources; a time-limited result need not be optimal |

The model can remain unchanged when switching between these families.[2][8]

Local search is the default. Its configurable move types determine which neighboring assignments it evaluates. Time and applied-move limits provide stopping conditions; without configured stopping limits, it searches until reaching a local optimum. Discontinuous requirements can make incremental search get stuck.[9]

## Production use at Meta

Meta uses Rebalancer for database-shard placement, allocating servers to services, traffic routing, serverless-function locality, and balancing online machine-learning training across regions. Its September 2026 release post reported the following operating scale.[1]

| Reported measure | Value and scope |
|---|---|
| Daily assignment problems | Roughly 40 million |
| Distinct problem formulations | More than 30 |
| 99th-percentile solve time | 12 seconds for a problem with 265,000 objects and 3,200 bins |
| Large-problem average | 171 seconds for problems exceeding 1 million objects with 5,000 bins; more than 3,400 such runs |

These figures describe Meta's workloads, not a guaranteed runtime for arbitrary models.[1]

## Research and evaluation

Neeraj Kumar and eight coauthors presented Rebalancer at OSDI 2024. In one Azure-data placement experiment involving 10,000 pods and 500 nodes, the paper reported 94.6% placement with an optimal MIP solver, 92.8% with SINGLE_GREEDY, and 93.2% with SINGLE_RANDOM. SINGLE_RANDOM ran faster but placed fewer pods than the MIP baseline in that experiment.[7]

The paper's separate DCM comparison used published DCM measurements rather than running both systems on identical hardware, because of security and dependency restrictions.[7]

## Explorer and distribution

Rebalancer Explorer is a web interface for inspecting solver inputs, assignments, goals, constraints, and solution scores. Its Next.js frontend communicates through a JSON proxy with a C++ Thrift backend. Docker Compose can start these components with example problem bundles. The proxy URL and bearer token are configurable; the token is required unless proxy authentication has explicitly been disabled.[10]

Rebalancer is distributed under Apache 2.0. Python installation uses `pip install rebalancer`; the repository also provides platform-specific native builds and packages. Building the C++ library from source does not itself create the Python package.[2]

## See also

- [Meta AI](https://aiwiki.ai/wiki/meta_ai)

## References

1. Engineering at Meta. [Open-Sourcing Rebalancer: A Generic, High-Performance Library for Solving Assignment Problems](https://engineering.fb.com/2026/09/21/open-source/rebalancer-generic-high-performance-library-assignment-problems/). September 21, 2026.
2. Meta. [Rebalancer repository and README](https://github.com/facebook/rebalancer). GitHub.
3. Meta. [Core Concepts](https://facebook.github.io/rebalancer/docs/core-concepts/overview/). Rebalancer documentation.
4. Meta. [Goals and Constraints](https://facebook.github.io/rebalancer/docs/reference/). Rebalancer documentation.
5. Meta. [Constraint policy](https://facebook.github.io/rebalancer/docs/reference/constraint-policy/). Rebalancer documentation.
6. Meta. [Goal priorities](https://facebook.github.io/rebalancer/docs/reference/goal-priorities/). Rebalancer documentation.
7. Kumar, Neeraj, et al. [Optimizing Resource Allocation in Hyperscale Datacenters: Scalability, Usability, and Experiences](https://www.usenix.org/system/files/osdi24-kumar.pdf). OSDI 2024, pp. 507-528.
8. Meta. [Solver Overview](https://facebook.github.io/rebalancer/docs/solvers/overview/). Rebalancer documentation.
9. Meta. [Local Search Solver](https://facebook.github.io/rebalancer/docs/solvers/local-search/). Rebalancer documentation.
10. Meta. [Rebalancer Explorer](https://facebook.github.io/rebalancer/docs/explorer/). Rebalancer documentation.
