Skip to content

Commit 71b4543

Browse files
sudo87rajujith
andauthored
Add Deployment planners documentation (#594)
Co-authored-by: Jithin Raju <rajujith@gmail.com>
1 parent 76d9008 commit 71b4543

File tree

4 files changed

+119
-18
lines changed

4 files changed

+119
-18
lines changed
72 KB
Loading
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
.. Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information#
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing,
10+
software distributed under the License is distributed on an
11+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12+
KIND, either express or implied. See the License for the
13+
specific language governing permissions and limitations
14+
under the License.
15+
16+
17+
Deployment Planners
18+
======================
19+
20+
21+
Deployment planners determine *how and where instances* are placed across clusters within a zone.
22+
A planner builds and orders a *list of candidate clusters* based on a placement strategy such as available capacity, user dispersion, or pod concentration.
23+
This ordered list is then passed to the *host allocator*, which attempts to deploy the instance following the planner’s priority order.
24+
25+
Administrators can configure the global setting ``vm.deployment.planner`` to define the default deployment planner for the environment.
26+
This can also be overridden per *Compute Offering*, allowing flexible control over how instances are distributed across the infrastructure.
27+
28+
Available Planners
29+
------------------
30+
31+
FirstFitPlanner
32+
~~~~~~~~~~~~~~~
33+
34+
The ``FirstFitPlanner`` ranks all clusters in a zone by their *available (free) capacity*, placing clusters with the most available resources at the top of the list.
35+
This approach prioritizes capacity-driven placement, ensuring efficient utilization of resources across the zone.
36+
37+
UserDispersingPlanner
38+
~~~~~~~~~~~~~~~~~~~~~
39+
40+
The ``UserDispersingPlanner`` aims to *spread a user’s instances across multiple clusters*, reducing the impact of any single cluster failure on that user.
41+
42+
#. The planner counts the number of instances in the *Running* or *Starting* state for the user’s account in each cluster.
43+
#. Clusters are sorted in **ascending order** based on this count, so clusters with fewer instances from the user are preferred.
44+
#. The global setting ``vm.user.dispersion.weight`` (default: ``1``) controls how strongly dispersion affects ordering:
45+
* ``1``: Ranking is based entirely on dispersion.
46+
* ``< 1``: Available capacity has more influence in placement decisions.
47+
48+
Lowering the dispersion weight allows a balance between *even distribution* and *efficient capacity usage*.
49+
50+
UserConcentratedPodPlanner
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
53+
The ``UserConcentratedPodPlanner`` focuses on *pod-level affinity*, preferring pods where the user already has active instances.
54+
55+
#. The planner identifies all pods in the zone that contain *Running* instances for the user’s account.
56+
#. Pods are sorted in **descending order** by the number of user instances — pods with more user instances come first.
57+
#. Clusters from these pods are then added to the top of the list in that order, so deployment is biased toward pods where the user is already active.
58+
#. Clusters within each pod are *not* further sorted by capacity or instance count.
59+
#. If no pods contain user instances, the cluster order remains unchanged.
60+
61+
Summary of Planner Behavior
62+
---------------------------
63+
64+
.. list-table::
65+
:header-rows: 1
66+
67+
* - Planner
68+
- Placement Focus
69+
- Ordering Criteria
70+
- Typical Use Case
71+
* - FirstFitPlanner
72+
- Capacity
73+
- Descending by available resources
74+
- Capacity-optimized or general-purpose placement
75+
* - UserDispersingPlanner
76+
- Dispersion
77+
- Ascending by user instance count (optionally weighted with capacity)
78+
- Distribute user instances evenly across clusters
79+
* - UserConcentratedPodPlanner
80+
- Pod Affinity
81+
- Descending by user instance count per pod
82+
- Keep user instances within the same pod for locality or data proximity
83+
84+
Pod-Level vs Cluster-Level Allocation
85+
------------------------------------
86+
87+
When ``apply.allocation.algorithm.to.pods = true``:
88+
The allocation algorithm (for example, *FirstFit*) is applied at *pod granularity* first.
89+
The planner will evaluate or rank pods according to the allocation heuristics — for *FirstFit*, that means prioritizing pods with more available capacity according to the FirstFit capacity checks.
90+
After pods are ordered, the planner then considers clusters *inside each pod* — typically evaluating clusters within the selected pod in order (or applying cluster-level heuristics only within that pod).
91+
In other words, *pod-level ordering happens before cluster selection*.
92+
93+
When ``apply.allocation.algorithm.to.pods = false`` (the default in many deployments):
94+
The allocation algorithm operates at the *cluster level* across the entire zone.
95+
96+
|deployment-planner-diagram.png|
97+
98+
.. |deployment-planner-diagram.png| image:: /_static/images/deployment-planner-diagram.png
99+
:alt: Deployment Planner Diagram

source/adminguide/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Managing VM and Volume Allocation
138138
.. toctree::
139139
:maxdepth: 4
140140

141+
deployment_planners
141142
host_and_storage_tags
142143
arch_types
143144
vm_volume_allocators

source/adminguide/vm_volume_allocators.rst

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ VM allocator supports following algorithms to select a host in the cluster:
3737
.. cssclass:: table-striped table-bordered table-hover
3838

3939
============================= ========================
40-
Algorithm Description
40+
Algorithm Description
4141
============================= ========================
42-
random Selects a host in the cluster randomly.
43-
firstfit Selects the first available host in the cluster.
42+
random Selects a host in the cluster randomly.
43+
firstfit Selects the first available host in the cluster.
4444
userdispersing Selects the host running least instances for the account, aims to spread out the instances belonging to a single user account.
45-
userconcentratedpod_random Selects the host randomly aiming to keep all instances belonging to single user account in same pod.
46-
userconcentratedpod_firstfit Selects the first suitable host from a pod running most instances for the user.
47-
firstfitleastconsumed Selects the first host after sorting eligible hosts by least allocated resources (such as CPU or RAM).
45+
userconcentratedpod_random Behaves same as random algorithm.
46+
userconcentratedpod_firstfit Behaves same as firstfit algorithm.
47+
firstfitleastconsumed Selects the first host after sorting eligible hosts by least allocated resources (such as CPU or RAM).
4848
============================= ========================
4949

5050
Use global configuration parameter:
@@ -62,14 +62,14 @@ Volume allocator supports following algorithms to select a host in the cluster:
6262
.. cssclass:: table-striped table-bordered table-hover
6363

6464
============================= ========================
65-
Algorithm Description
65+
Algorithm Description
6666
============================= ========================
67-
random Selects a storage pool in the cluster randomly.
68-
firstfit Selects the first available storage pool in the cluster.
69-
userdispersing Selects the storage pool running least instances for the account, aims to spread out the instances belonging to a single user account.
70-
userconcentratedpod_random Selects the storage pool randomly aiming to keep all instances belonging to single user account in same pod.
71-
userconcentratedpod_firstfit Selects the first suitable pool from a pod running most instances for the user.
72-
firstfitleastconsumed Selects the first storage pool after sorting eligible pools by least allocated resources.
67+
random Selects a storage pool in the cluster randomly.
68+
firstfit Selects the first available storage pool in the cluster.
69+
userdispersing Selects the storage pool running least instances for the account, aims to spread out the instances belonging to a single user account.
70+
userconcentratedpod_random Behaves same as random algorithm.
71+
userconcentratedpod_firstfit Behaves same as firstfit algorithm.
72+
firstfitleastconsumed Selects the first storage pool after sorting eligible pools by least allocated resources.
7373
============================= ========================
7474

7575
.. note::
@@ -98,11 +98,11 @@ Key: `host.capacityType.to.order.clusters`
9898
.. cssclass:: table-striped table-bordered table-hover
9999

100100
========= ========================
101-
Value Behavior
101+
Value Behavior
102102
========= ========================
103-
CPU Prioritizes resources with the most available CPU.
104-
RAM Prioritizes resources with the most available memory.
105-
COMBINED Uses a weighted formula to balance CPU and RAM in prioritization.
103+
CPU Prioritizes resources with the most available CPU.
104+
RAM Prioritizes resources with the most available memory.
105+
COMBINED Uses a weighted formula to balance CPU and RAM in prioritization.
106106
========= ========================
107107

108108
**Additional Configuration for COMBINED**
@@ -132,8 +132,9 @@ Example Configuration
132132
Above config prioritizes CPU at 70% weight and RAM at 30% when ranking pods, clusters, and hosts.
133133
134134
.. note::
135-
- `host.capacityType.to.order.clusters` is only respected for host ordering when:
135+
- `host.capacityType.to.order.clusters` is only respected for cluster/host ordering when:
136136
.. code:: bash
137137
138+
vm.deployment.planner: FirstFitPlanner, UserDispersingPlanner (when vm.user.dispersion.weight is < 1)
138139
vm.allocation.algorithm: firstfitleastconsumed
139140
- When using COMBINED, make sure to tune cpu.to.memory.capacity.weight to reflect your environment’s resource constraints and workload profiles.

0 commit comments

Comments
 (0)