Meta Rebalancer in Practice: Task Placement and Optimization Tutorial

A hands-on guide to modeling, constraints, priorities, and solving strategies in Meta's open-source Rebalancer solver.
This article introduces Meta's open-source task placement solver Rebalancer, which uses a C++ core with Python bindings to allocate tasks across data centers and racks while satisfying constraints and objectives. It covers building data center models in Python, the multi-objective priority mechanism, and compares local search against the HiGHS exact solver with public benchmark data. It ends with getting-started advice.
Meta's open-source Rebalancer is a solver for data center task placement and optimization, offering a C++ core with Python bindings. Based on a hands-on tutorial, this article walks through its core usage to help developers get up to speed quickly.

What Is Rebalancer
Rebalancer is Meta's tool for solving task placement problems. Its core idea is to distribute tasks across racks and data centers while satisfying various constraints and optimization objectives.
The tool is written in C++ for its core logic and exposes its interface through Python bindings, balancing performance and ease of use. Developers can quickly set up scenarios and define constraints in Python, then hand them off to the underlying solver.
Unlike many general-purpose schedulers, Rebalancer emphasizes "rebalancing"—that is, finding a better allocation by having the solver improve upon an existing placement.
Task placement falls under combinatorial optimization in computer science. A typical formulation models it as constrained integer programming or a constraint satisfaction problem: given a set of tasks and a set of candidate locations, minimize or maximize several objective functions while satisfying constraints such as capacity, affinity, and anti-affinity. Most problems of this kind are NP-hard, and once the scale grows even slightly, finding an optimal solution within an acceptable time becomes infeasible—so real-world systems generally rely on heuristics or approximation algorithms. Meta's Rebalancer targets exactly this kind of large-scale, multi-constraint real-world scenario, and its "rebalancing" semantics mean it doesn't allocate from scratch but instead makes incremental adjustments on top of an existing layout, which can significantly reduce migration costs and solving difficulty in large data centers.
Building Data Center and Task Models
The first step in using Rebalancer is constructing a data center model. The tutorial shows how to define the hierarchical structure of a data center and place tasks onto different racks.
This modeling process requires describing the physical topology—for example, which racks a data center contains and the capacity limits of each rack. Tasks serve as the objects to be allocated, and their resource requirements and placement constraints need to be specified.
Through the Python bindings, these models can be expressed in a relatively intuitive way without having to work directly with the C++ layer.
Handling Constraints and Objective Priorities
A key capability of Rebalancer is handling multiple constraint types and objective priorities. In real scenarios, task placement is rarely a single-objective problem; instead, it requires trade-offs among multiple objectives.
The tutorial covers how to define constraints and how to set objective priorities. The solver optimizes in priority order, improving higher-level objectives as much as possible while satisfying hard constraints.
This design lets developers express strategies like "ensure availability first, then optimize load balancing," closely matching the operational needs of real data centers.
In multi-objective optimization, common approaches include weighted-sum methods and lexicographic optimization. The former merges multiple objectives into a single weighted objective, but the weights are hard to tune and can mask extreme cases; the latter ranks objectives by priority and solves them in sequence, where each subsequent objective must not degrade the optimal value already achieved by the previous one. Rebalancer's hierarchical priority mechanism is close to the latter, enabling developers to clearly express a strategy of "hard constraints first, soft objectives second." Hard constraints typically refer to inviolable rules, such as rack capacity limits; soft constraints enter the objective function as penalty terms and are allowed to be moderately violated when necessary, providing greater solving flexibility near the feasibility boundary.
Local Search vs. HiGHS Exact Solver
The tutorial also compares two solving strategies: local search and the HiGHS exact solver.
Local search is fast and well-suited for quickly obtaining feasible solutions in large-scale scenarios; HiGHS, as an exact solver, can produce better—even optimal—solutions on smaller-scale problems, but at higher computational cost.
The article cites public benchmark data for developers to reference how the two methods perform across different scenarios. In practice, you can choose the appropriate solving approach based on problem scale and precision requirements.
HiGHS, short for High performance software for linear optimization, is an open-source linear and mixed-integer programming solver led by a team at the University of Edinburgh. It supports model types such as LP, MIP, and QP and is widely used in both industry and academia. It employs classical algorithms including the simplex method, interior-point methods, and branch-and-bound, and can either prove optimality or provide an optimality gap within a given time. Unlike heuristics such as local search, exact solvers do not skip over the solution space, so they typically return global optima on smaller problems—but computational complexity grows quickly with the number of variables and constraints, and extremely large-scale scenarios may result in unacceptable solving times. Rebalancer integrates HiGHS as an optional backend precisely to let developers trade off precision against efficiency as needed.
How to Get Started
For developers wanting to try Rebalancer, it's recommended to start with the official examples, using the Python bindings to set up a small-scale scenario and understand the full workflow of modeling, constraints, and solving.
Once you've grasped the basics, introduce priority objectives and run comparative experiments with different solvers. This way you can get quick feedback while gradually deepening your understanding of its optimization capabilities.
One-line Summary
A hands-on guide to modeling, constraints, priorities, and solving strategies in Meta's open-source Rebalancer solver.
Paragraph Summary
This article introduces Meta's open-source task placement solver Rebalancer, which uses a C++ core with Python bindings to allocate tasks across data centers and racks while satisfying constraints and optimization objectives. It first explains its "rebalancing" positioning, then covers how to build data center hierarchies and task models in Python. The core section addresses the multi-objective priority mechanism: the solver optimizes in priority order, improving higher-level objectives while satisfying hard constraints. The article also compares local search and the HiGHS exact solver—the former is fast and suited to large scale, while the latter yields better solutions at higher cost—and includes public benchmark data. Finally, it offers getting-started advice: begin with official examples and small-scale scenarios, then gradually introduce priority objectives and run comparative experiments with different solvers.
Related articles

Felix Rieseberg Personal Homepage
Felix Rieseberg's personal homepage sparks attention on Hacker News. This article covers the Slack engineer's technical background, the rise and fall of nativefier, and the value of a developer homepage as a tech calling card.

@ai-sdk/vue 3.0.306 Patch Release Syncs with [email protected] Update
@ai-sdk/vue 3.0.306 released, synced with [email protected]. A routine patch release for the Vercel AI SDK ecosystem with no public API changes; the Vue adapter layer stays version-aligned with the core package.

Gemini 4 Argon API Launches: The Era of Million-Token Output Begins
Google launches Gemini 4 Argon with sparse MoE architecture, up to 1M output tokens, and a 68.90% Vals Index score, available across API, AI Studio, and the Gemini app.