SmartMedia - Load Balancing in Routing Script
Posted by Michal Podoski, Last modified by Daniel Lizaola on 04 January 2018 04:14 PM

This article covers addition of Priority and Load sharing to any routing script. Idea behind the script is to regroup routes of the same kind, distribute load among them and prioritize one group versus another. Alternatively you can do the same on NAPs. You will use two additional parameters in the routes: group and weight.

group serves as two purpose:

  1. priority: a lower value will have higher priority
  2. matching routes of the same group will load share according to the weight parameter

'group' values should range from 0 to 100

weight will load share calls among matching routes of the same group. Used values should range from 10 to 100.

Setting up Filter Scripts

Filter setup requires main script to be modified. Let's assume we are using simple_routing.rb as main script

First, go to the routing script section of the Web Portal

Gateway -> Routing scripts -> Example Scripts -> simple_routing.rb [Edit]

Three things need to be added. At the start of the script:

require 'nap_group_weight_load_balancer'

In the main class:

include NapGroupAndWeightLoadBalancer
after_filter :method => :filter_by_group_and_weight, :weight_by => :call_attempts


The final script will look like this:

require 'base_routing'
require 'nap_group_weight_load_balancer'

class SimpleRouting < BaseRouting
  include NapGroupAndWeightLoadBalancer
  
  route_match :call_field_name => :called
  route_match :call_field_name => :calling
  route_match :call_field_name => :nap
  route_match :method => :match_nap_availability
  route_remap :call_field_name => :called, :route_field_name => :remapped_called
  route_remap :call_field_name => :calling, :route_field_name => :remapped_calling
  route_remap :call_field_name => :nap, :route_field_name => :remapped_nap
  
  after_filter :method => :filter_by_group_and_weight, :weight_by => :call_attempts

end

Adding New Custom Variables 

You will need two custom columns to use this script. There is a default value creates and it can be changed in each route afterwards.

Gateway -> Routes -> Create New Route Column

Name: group
Type attributes: integer
Default: (must be left empty)

Gateway -> Routes -> Create New Route Column

Name: weight
Type attributes: integer
Default: (must be left empty)

(8748 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).