Adding Load Sharing to a Routing Script
This article show you how to integrate a routing script filter that sorts matching routes by priority and weight (weight is used for load-sharing when multiple routes have the same priority).
Once ordered, the routes will be used, one after the other until a route is working (according to Route Retry parameters).
NOTE: starting from version 3.0.80 this script is installed by default (only for new installations, or a fresh routing script)
Setting up Filter Scripts
To setup a Filter, the main script needs to be modified. The main script can be either simple_routing.rb, or any other script.
First, go to the routing script section of the Web portal
Gateway -> Routing scripts -> Example Scripts -> simple_routing.rb [Edit]Three things must be added. At the start of the script:
require 'priority_and_weight_load_balancer' unless defined?(PriorityAndWeightLoadBalancer)In the main class:
include PriorityAndWeightLoadBalancer after_filter :method => :filter_by_priority_and_weight,
:weight_by => :call_attempts,
:default_load_share_mode => :alternate_backup,
:max_priority_delta => -1The final script will look like this (with possibly other filters also included):
Adding New Custom Variables
You need to add two custom columns to use this script. There is a default value and it can be changed in each route afterwards.
Name: priority Type attributes: integer Default: 10
Name: weight Type attributes: integer Default: 100
Last updated
Was this helpful?

