You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/concepts/router/distribution-concepts.md
+19-17Lines changed: 19 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,31 +3,33 @@ title: Distribution mode concepts for Azure Communication Services
3
3
titleSuffix: An Azure Communication Services concept document
4
4
description: Learn about the Azure Communication Services Job Router distribution mode concepts.
5
5
services: azure-communication-services
6
-
manager: chpalm
7
-
ms.author: chpalm
6
+
manager: radubulboaca
7
+
ms.author: radubulboaca
8
8
author: tophpalmer
9
9
ms.date: 05/06/2022
10
-
ms.topic: conceptual
10
+
ms.topic: article
11
11
ms.service: azure-communication-services
12
12
---
13
13
14
14
# Distribution modes
15
15
16
-
When creating a distribution policy, we specify one of the following distribution modes to define the strategy to use when distributing jobs to workers:
16
+
Distribution policies support the following distribution modes to define the strategy used to distribute jobs to workers:
17
17
18
18
## Round robin mode
19
19
20
-
Jobs will be distributed in a circular fashion such that each available worker will receive jobs in sequence.
20
+
Jobs are distributed in a circular fashion such that each available worker receives jobs in sequence.
21
21
22
22
## Longest idle mode
23
23
24
-
Jobs will be distributed to the worker that is least utilized first. If there's a tie, we'll pick the worker that has been available for the longer time. Utilization is calculated as a `Load Ratio` by the following algorithm:
24
+
Jobs are distributed to the worker that's least utilized first. If there's a tie, the worker available for the longest time is picked. Utilization is calculated as a `Load Ratio` by the following algorithm:
25
25
26
26
Load Ratio = Aggregate of capacity consumed by all jobs assigned to the worker / Total capacity of the worker
27
27
28
+
Events such as `RouterWorkerRegistered`, are resetting the worker's idle time, which may impact the distribution based on longest idle time.
29
+
28
30
### Example
29
31
30
-
Assume that each `chat` job has been configured to consume one capacity for a worker. A new chat job is queued into Job Router and the following workers are available to take the job:
32
+
Assume that each `chat` job is configured to consume one capacity unit for a worker. A new chat job is queued into Job Router and the following workers are available to take the job:
31
33
32
34
```text
33
35
Worker A:
@@ -57,17 +59,17 @@ LastAvailable: 2 min ago
57
59
Workers would be matched in order: D, C, A, B
58
60
```
59
61
60
-
Worker D has the lowest load ratio (0), so Worker D will be offered the job first. Workers A and C are tied with the same load ratio (0.6). However, Worker C has been available for a longer time (7 minutes ago) than Worker A (5 minutes ago), so Worker C will be matched before Worker A. Finally, Worker B will be matched last since Worker B has the highest load ratio (0.75).
62
+
Worker D has the lowest load ratio (0), so the job is first offered to Worker D. Workers A and C are tied with the same load ratio (0.6). However, Worker C is available for a longer time (7 minutes ago) than Worker A (5 minutes ago), so Worker C is matched before Worker A. Finally, Worker B is matched last since Worker B has the highest load ratio (0.75).
61
63
62
64
## Best worker mode
63
65
64
-
The workers that are best able to handle the job are picked first. The logic to rank Workers can be customized, with an expression or Azure function to compare two workers by specifying a Scoring Rule. [See example](../../how-tos/router-sdk/customize-worker-scoring.md)
66
+
The workers that are best able to handle the job are picked first. The logic to rank Workers can be customized, with an expression or Azure function to compare two workers by specifying a Scoring Rule. [See example](../../how-tos/router-sdk/customize-worker-scoring.md)
65
67
66
-
When a Scoring Rule isn't provided, this distribution mode will use the default scoring method instead, which evaluates workers based on how the job's labels and selectors match with the worker's labels. The algorithms are outlined below.
68
+
When a Scoring Rule isn't provided, this distribution mode uses the default scoring method instead, which evaluates workers based on how the job's labels and selectors match with the worker's labels.
67
69
68
70
### Default label matching
69
71
70
-
For calculating a score based on the job's labels, we increment the `Match Score` by 1 for every worker label that matches a corresponding label on the job and then divide by the total number of labels on the job. Therefore, the more labels that matched, the higher a worker's `Match Score`. The final `Match Score`will always be a value between 0 and 1.
72
+
The `Match Score`is incremented by 1 for every worker label that matches a corresponding label on the job and then divide by the total number of labels on the job. Therefore, the more labels that matched, the higher a worker's `Match Score`. The final `Match Score`is always a value between 0 and 1.
71
73
72
74
#### Example
73
75
@@ -122,15 +124,15 @@ Worker B's match score = 1 (for matching english language label) / 2 (total numb
122
124
Worker C's match score = 1 (for matching english language label) / 2 (total number of labels) = 0.5
123
125
```
124
126
125
-
Worker A would be matched first. Next, Worker B or Worker C would be matched, depending on who was available for a longer time, since the match score is tied.
127
+
Worker A would be matched first. Next, Worker B or Worker C would be matched, depending on who was available for a longer time, since the match score is tied.
126
128
127
129
### Default worker selector matching
128
130
129
-
In the case where the job also contains worker selectors, we'll calculate the `Match Score` based on the `LabelOperator` of that worker selector.
131
+
In the case where the job also contains worker selectors, the `Match Score` is calculated based on the `LabelOperator` of that worker selector.
130
132
131
133
#### Equal/notEqual label operators
132
134
133
-
If the worker selector has the `LabelOperator``Equal` or `NotEqual`, we increment the score by 1 for each job label that matches that worker selector, in a similar manner as the `Label Matching`above.
135
+
The score is incremented by 1 if the `LabelOperator`worker selector is `Equal` or `NotEqual`, for each job label that matches that worker selector, similar to the `Label Matching`mechanism.
134
136
135
137
##### Example
136
138
@@ -185,11 +187,11 @@ Worker E's match score = 1 (for matching department selector) + 1 (for matching
185
187
Worker F's match score = 1 (for segment not equal to vip) / 2 (total number of labels) = 0.5
186
188
```
187
189
188
-
Worker E would be matched first. Next, Worker D or Worker F would be matched, depending on who was available for a longer time, since the match score is tied.
190
+
Worker E would be matched first. Next, Worker D or Worker F would be matched, depending on who was available for a longer time, since the match score is tied.
189
191
190
192
#### Other label operators
191
193
192
-
For worker selectors using operators that compare by magnitude (`GreaterThan`/`GreaterThanEqual`/`LessThan`/`LessThanEqual`), we'll increment the worker's `Match Score` by an amount calculated using the logistic function (See Fig 1). The calculation is based on how much the worker's label value exceeds the worker selector's value or a lesser amount if it doesn't exceed the worker selector's value. Therefore, the more worker selector values the worker exceeds, and the greater the degree to which it does so, the higher a worker's score will be.
194
+
For worker selectors using operators that compare by magnitude (`GreaterThan`/`GreaterThanEqual`/`LessThan`/`LessThanEqual`), the worker's `Match Score`is incremented by an amount calculated using the logistic function (See Fig 1). The calculation is based on how much the worker's label value exceeds the worker selector's value or a lesser amount if it doesn't exceed the worker selector's value. Therefore, the more worker selector values the worker exceeds, and the greater the degree to which it does so, the higher a worker's score is.
193
195
194
196
:::image type="content" source="../media/router/distribution-concepts/logistic-function.png" alt-text="Diagram that shows logistic function.":::
All three workers match the worker selectors on the job and are eligible to work on it. However, we can see that Worker H exceeds the "sales" worker selector's value by a margin of 5. Meanwhile, Worker I only exceeds the cost worker selector's value by a margin of 1. Worker G doesn't exceed any of the worker selector's values at all. Therefore, Worker H would be matched first, followed by Worker I and finally Worker G would be matched last.
270
+
All three workers match the worker selectors on the job and are eligible to work on it. However, we can see that Worker H exceeds the "sales" worker selector's value by a margin of 5. Meanwhile, Worker I only exceeds the cost worker selector's value by a margin of 1. Worker G doesn't exceed any of the worker selector's values at all. Therefore, Worker H would be matched first, followed by Worker I and finally Worker G would be matched last.
0 commit comments