Sometimes you may need to split traffic to some defined shares of it to different gateways. For example, to route 20% of calls to first gateway and 30% of calls to the second gateway and the rest 50% to the third gateway. The following example describe how to configure this.
- You have 3 gateways and you need to distribute traffic between them;
- 20% of traffic should be routed to the 1st gateway;
- 30% of traffic should be routed to the 2nd gateway;
- 50% of traffic should be routed to the 3rd gateway.
In order to achieve this you need to use a Weighted Distribution policy of a Routing Group:Next, you need to specify the weight for every routing entry according to your requirements:
In fact the Weight column accepts any values because the probability is calculated by the following formula:
It means that you can specify even the values 40 and 30 as below:
which anyway will result into the same probability:
100 / 70 * 40 = 57% (Probability of route #1) 100 / 70 * 30 = 43% (Probability of route #2)
The only difference is that the values (20, 30, 50) which give 100% in total are more readable. There is no need for Administrator to do any calculations.
Sometimes usage of the values that don't give 100% in total leads to wrong perception of the configuration. For example, Administrator can define the values like 35, 45 and 85 expecting that it will result into 35%, 45% and 85%probability. However, this is not true. If to consider the formula above, it will result into 21.2%, 27.2% and 51.5%.
Saving results of previous challenges
Another important thing about Weighted Distribution policy is that it does not remember any of previous results of the "lottery".
In other words, if you have 100 calls, it doesn't guarantee that exactly 20 calls will go to one route, another 30 calls will go to another route and the rest 50 calls will go to the last route (considering the main example of this article). Instead, every new call will participate in the challenge of 20/30/50 from the scratch (without any relation to the previous results).