Multi Zones
PaaS provides an ability to efficiently manage the hardware capacities of the platform with the help of the multi zones approach. The implementation extends the default anti-affinity rules for the applications' high-availability, providing direct control of the process.
The following two steps are required to configure and utilize the multi zones feature:
- marking hosts with labels in JCA - allows applying labels to hosts to separate them by some criteria (e.g. quality)
- defining distribution between hosts in JPS - ensures that the installed solution is evenly distributed across hardware servers with the specified labels
- configuring templates distribution between hosts - allows installing specific stacks on the dedicated hardware only
The distribution is performed based on the number of existing nodes and hardware load rating. The exact multi zones distribution algorithm for container addition is described in the appropriate section below.
Host Labels in JCA
To provide labels for your hardware servers, follow the steps below:
1. Navigate to the JCA > Cluster > Hosts section and click the Change Labels button at the tools panel.
2. In the opened edit mode for labels, you can:
- select the host(s), which should be adjusted, by ticking the required ones in the first column of the table
- choose the type of adjustment from the appropriate drop-down list:
- Add to Existing - adds the provided labels to the list of existing ones
- Replace All with - adds the provided labels while discarding all of the existing ones
- Find and Remove these - removes labels that match the provided ones
- Remove All - removes all of the labels
- provide label(s) in the “{name}: {value}” formatTip: When providing labels, the platform automatically fetches a list of the already existing ones for quick management. Multiple options can be selected at once using the Ctrl key (double-click the added label to edit it). You can also hover over the particular label in the list and press F2 to add it in the edit mode.
Notes:
- you can view the full list of labels for the host (if it does not fit the column width) by hovering over the appropriate “...” marking
- just a single {value} can be provided for each unique {name} per host
- the zone {name} is considered a default label and, if provided, is displayed first within the list
- the maximum number of labels per host is 50
- the maximum length of {name} is 63 and of {value} - 255; these values are validated by the “^[a-zA-Z0-9._\-]+$” and “^[a-zA-Z0-9._\-]*$” regex respectively
3. For better clarity, all existing labels with the same {name} as the provided one (i.e. disk in the image below) are highlighted and moved to the left of the list. If the existing {value} of such a label will be redefined, it is additionally colored in orange.
When ready, click Apply to save changes or Cancel to discard them.
Distribution between Hosts in JPS
Once labels for hosts are configured in JCA, you can start managing the distribution criteria for the nodes in your JPS package. The appropriate distribution parameter defines the logic in the layer specifics, which consist of the following two options:
- zones - sets a filter for allowed zones (groups of hosts custom-defined by labels) in the “{name}: {value}” format, e.g. zones: [{provider: azure}, {provider: amazon}]
- mode - defines the behavior in case of the target zone unavailability
- SOFT - the operation should proceed on the next zone/host defined by the multi zones algorithm (this option is used by default)
- STRICT - the operation should be terminated with an error
Notes:
- the distribution is performed in the confines of a single host group (i.e. user environment region)
- the default zone {name} can be skipped when providing zones parameter, i.e. the zones: [“a”, “b”] and zones: [{zone: a}, {zone: b}] expressions are equal
- if zones with two or more {value} are specified for a single {name}, hosts with either of these values will be allowed for distribution
- if zones with two or more {name} are specified, only hosts with all these labels will be allowed for distribution
- if zones are not specified, distribution is performed across all hosts
- the maximum number of elements in zones is 10
- the maximum number of unique {value} per each {name} is 20
For example, the distribution configured in the package below ensures that nodes are created only on the hosts with the disk: ssd label.
|
|
Environments with custom distribution rules are marked with a dedicated custom label in the JCA > Cluster > Environments > Topology section, which allows viewing the layer distribution parameters.
For the detailed example of the multi zones distribution algorithm, refer to the section below.
Templates Distribution between Hosts
You can configure template distribution on the platform by specifying the appropriate distribution rules. For example, if you have a VM-dedicated hardware set, you can ensure that all the VM nodes will be created on that host only.
1. In order to configure template distribution, navigate to the JCA > Templates section, select the required stack, and click the Distribution option at the tools bar. Alternatively, you can hover over the Distribution column and click the appeared Add button (or Edit for existing rules).
2. Within the opened Distribution Settings frame, you can provide the required distribution rules by defining the following parameters:
- zones - list of allowed hosts with the matching labels (in the “{name}: {value}” format)
- mode - behavior upon the target zone unavailability
- STRICT - the stack creation is terminated with an error
- SOFT - the operation is proceeded on the next suitable zone/host (according to the multi zones algorithm, default option)
Notes:
- the distribution is performed in the confines of a single host group (i.e. user environment region)
- the default zone {name} can be skipped when providing zones parameter, i.e. the zones: [“a”, “b”] and zones: [{zone: a}, {zone: b}] expressions are equal
- if zones with two or more {value} are specified for a single {name}, hosts with either of these values will be allowed for distribution
- if zones with two or more {name} are specified, only hosts with all these labels will be allowed for distribution
- if zones are not specified, distribution is performed across all hosts
- the maximum number of elements in zones is 10
- the maximum number of unique {value} per each {name} is 20
For example, the distribution rules below ensure that a stack is created only on the hosts with the zone: windows label.
|
|
3. Saved rules are displayed in the Distribution column of the Templates section.
Check out the detailed example on the multi zones distribution algorithm in the section below.
Distribution Algorithm Example
For example, we have a host group with six hosts and the following labels configured for them:
Name | Loadmark | Labels | Application Containers |
---|---|---|---|
hn01 | 50 | provider:azure; disk:HDD | 2 |
hn02 | 100 | provider:azure; disk:HDD | 1 |
hn03 | 20 | provider:azure; disk:SSD | - |
hn04 | 20 | provider:amazon; disk:SSD | 1 |
hn05 | 20 | provider:amazon; disk:SSD | 1 |
hn06 | 50 | provider:amazon; disk:SSD | 1 |
The distribution in the JPS package is defined with the following parameters:
|
|
According to this data, JPS will distribute containers between two zones. For future reference, we’ll name them as follows:
- zone1 - includes hosts with both provider:azure and disk:HDD labels: hn01, hn02
- zone2 - includes hosts with both provider:amazon and disk:SSD labels: hn04, hn05, hn06
So, let’s assume that we already have some Application Containers created (see the same-named column in the table above) and need to add one more node:
1. A zone with the least number of nodes is selected. In case of equality, zone with the least loadmark (average from all the included hosts) is selected.
In our case, both zone1 and zone2 have three containers, their loadmarks are (50+100)/2=75 and (20+20+50)/3=30 respectively. Thus, zone2 is selected.
2. Next, the host within this zone should be selected. The process is similar, i.e. the host with the least number of containers and the lowest loadmark.
In our case, all hosts within zone2 have the same number of containers (one on each), and the lowest loadmark is 20 on both hn04 and hn05. So, the target host will be selected from these two randomly.