Multidimensional resource packing
Use lower bounds, explicit assignments, and heuristic limits instead of equating a good score with an optimal placement.
On this page
The question for today
What you’ll understand
- Construct and check a multidimensional assignment.
- Distinguish aggregate lower bounds from feasible placements.
- Explain online heuristic tradeoffs without claiming optimality.
A cluster can have enough total CPUs and memory yet lack a useful place for the next worker. Packing decides which workload shapes share which machines, and the shape matters as much as the total. The optimization is combinatorial: a locally attractive placement can strand capacity needed later. Practical schedulers therefore use policies and heuristics whose feasibility and performance limits should remain visible.
Describe assignments before optimizing scores
Let each job have a vector of requested resources and each node a capacity vector. An assignment is feasible only if the sum on every node fits every resource dimension and all hard constraints hold. Counting aggregate free capacity is a useful preliminary check, but it discards the distribution across nodes. An eight-GPU request that must stay within one node cannot use one free GPU on each of eight nodes unless the workload and allocation model explicitly support that decomposition.
Even classical one-dimensional bin packing is computationally difficult to optimize exactly in general; multidimensional and constrained versions retain that difficulty. A production scheduler also works online with incomplete future information and limited decision time. This motivates heuristics rather than a claim that one score finds a global optimum. Separate a proven feasibility filter from a preference score: a high score must never authorize placing a workload that violates a hard capacity or compatibility constraint.
Lower bounds can be unattainable
For identical nodes, total demand divided by node capacity gives a lower bound in each dimension; round up and take the largest. That bound does not prove a placement exists. Individual job sizes, complementary shapes, and constraints can force more nodes. Verify a proposed assignment explicitly, and distinguish an optimality proof from an example that merely fits. If a heuristic uses fewer machines than a baseline on one trace, that result does not establish a general approximation guarantee.
Packing policies can favor fuller nodes to leave others available, spread work to reduce interference, or balance several resources. These objectives conflict. Aggressive packing may improve allocation utilization while increasing shared-bandwidth contention or failure concentration. A scheduler score also depends on resource weights and normalization: CPU and memory units must not be compared as raw magnitudes. Preserve enough scoring diagnostics to explain why a feasible alternative was chosen and whether that choice actually improved the intended workload objective.
Validate online decisions against future shape sensitivity
Test adversarial arrival orders as well as common traces. A sequence of small jobs can fragment the fleet before a large gang arrives; a static optimum with all arrivals known in advance has information the online scheduler lacks. Compare policies under the same admission, preemption, and migration rules. Track unschedulable demand by shape, not only free resource percentages. A migration that repairs packing has a cost and can invalidate a simplistic claim that a better final arrangement was obtained for free.
The vector lab illustrates a componentwise packing check for two identical normalized requests. Reset, set angle to 45 degrees and magnitude to 1, predict the sum of two copies of each component, then Step. Repeat from Reset with both angle at 45 degrees and magnitude at 0.5. Assume unit capacity on both axes. The instrument draws only one request; add its components on paper. It cannot search assignments or certify an optimal packing, but it makes clear why each individual request fitting is insufficient.
Work it through
Pack complementary resource shapes
Two identical nodes each provide 16 cores and 16 GiB. There are two jobs of shape A = (10 cores, 6 GiB) and two of shape B = (6 cores, 10 GiB). Ignore overhead, topology, and interference.
Total CPU demand is 2 × 10 + 2 × 6 = 32 cores; memory demand is 2 × 6 + 2 × 10 = 32 GiB. Each aggregate lower bound is two nodes.
Place one A and one B on each node. Each sum is (16 cores, 16 GiB), so the assignment fits and attains the two-node bound in this example.
Packing two B jobs together appears CPU-feasible at 12 cores but exceeds memory at 20 GiB. A CPU-only test would accept an invalid assignment.
Two nodes are sufficient and necessary for this specific instance. The explicit complementary assignment, not just the aggregate totals, establishes sufficiency.
The living notebook
Explore the model
Interactive lab · vectors
Two fitting requests can still conflict
Reset, set angle = 45° and magnitude = 1, predict twice each component against unit capacities, then Step. Compare a fresh Reset with both angle = 45° and magnitude = 0.5. Only one request vector is drawn; this does not solve bin packing.
- x component
- 1.393
- y component
- 0.975
- Magnitude
- 1.7
Playback traces a fixed vector and its projections. Angle and magnitude set the geometry; the moving marker does not change them. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forFeasibility concerns sums on each node, not whether requests fit individually.
Pause & reason
Check your understanding
Your turn
Try it yourself
Three jobs each request 6 cores and 6 GiB. Identical nodes provide 10 cores and 10 GiB. Compute the aggregate lower bound and the actual minimum node count.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Check whether any pair of jobs fits one node after calculating total demand.
Compare with the solution
Total demand is 18 in each dimension, so the aggregate bound is ceil(18/10) = 2 nodes. Any pair requires 12 cores and 12 GiB, exceeding both capacities. Therefore no node can host two jobs, and three nodes are required. The gap demonstrates why an aggregate lower bound is not a feasible packing certificate.
Keep the idea
Take it with you
- Packing feasibility checks resource sums and constraints on every node.
- Aggregate demand gives lower bounds that may not be attainable.
- Heuristics require workload-specific evaluation and do not inherit optimality from their scores.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.