diff --git a/src/modules/dispatcher/README b/src/modules/dispatcher/README index 7f43b5c42bd..7db3838dece 100644 --- a/src/modules/dispatcher/README +++ b/src/modules/dispatcher/README @@ -188,17 +188,18 @@ Federico Cabiddu 1.40. Set the “ds_db_extra_attrs” parameter 1.41. Set the “ds_load_mode” parameter 1.42. Set reload_delta parameter - 1.43. ds_select_dst usage - 1.44. configuring load balancing with congestion detection - 1.45. ds_select_domain usage - 1.46. ds_select usage - 1.47. ds_select_routes usage - 1.48. ds_mark_dst usage - 1.49. ds_list_exists usage - 1.50. ds_is_from_list usage - 1.51. ds_load_unset usage - 1.52. dispatcher list file - 1.53. Kamailio config script - sample dispatcher usage + 1.43. latency_optimized_dispatching usage + 1.44. ds_select_dst usage + 1.45. configuring load balancing with congestion detection + 1.46. ds_select_domain usage + 1.47. ds_select usage + 1.48. ds_select_routes usage + 1.49. ds_mark_dst usage + 1.50. ds_list_exists usage + 1.51. ds_is_from_list usage + 1.52. ds_load_unset usage + 1.53. dispatcher list file + 1.54. Kamailio config script - sample dispatcher usage Chapter 1. Admin Guide @@ -1090,7 +1091,7 @@ modparam("dispatcher", "reload_delta", 1) 1/2/1 will be distributed as 25/50/25. After third host failing distribution will be changed to 33/67/0. Using this algorithm, you can also enable congestion control - by setting the attibute 'cc=1', when 'cc' is enabled the + by setting the attribute 'cc=1', when 'cc' is enabled the 'weight' attribute will also be used to control congestion tolerance. When facing congestion the weight of a gateway is lowered by 1 for every ms of estimated congestion, a 'rweight' @@ -1105,6 +1106,34 @@ modparam("dispatcher", "reload_delta", 1) forking). Note that the XAVPs are no longer set with the values of the destination records, no re-routing making sense in this case. + + “13” - latency optimized dispatching + - The algorithm will load balance using round-robin + prioritizing the gateways with the highest priority. + - If ds_ping_latency_stats is active the algorithm will adjust + the priority of the gateway automatically, the priority will + be lowered by 1 point every time the latency ms is as high as + the priority. + - If the attribute 'cc=1' is set, the latency used is + congestion ms : estimate (current latency ms) - average + (normal condition latency ms). + Example 1.43. latency_optimized_dispatching usage +Using this simple formula : + ADJUSTED_PRIORITY = PRIORITY - (ESTIMATED_LATENCY_MS/PRIORITY) + +GATEWAY | PRIORITY | ESTIMATED | ADJUSTED | LOAD + # | | LATENCY | PRIORITY | DISTRIBUTION + 1 | 30 | 21 | 30 | 33% + 2 | 30 | 91 | 27 | 0% + 3 | 30 | 61 | 28 | 0% + 4 | 30 | 19 | 30 | 33% + 5 | 30 | 32 | 29 | 0% + 6 | 30 | 0 | 30 | 33% + 7 | 30 | 201 | 24 | 0% + + +With congestion control the formula becomes : + CONGESTION_MS = CURRENT_LATENCY_MS - NORMAL_CONDITION_LATENCY_MS + ADJUSTED_PRIORITY = PRIORITY - (CONGESTION_MS/PRIORITY) + “X” - if the algorithm is not implemented, the first entry in set is chosen. * limit - the maximum number of items to be stored in XAVP list for @@ -1113,7 +1142,7 @@ modparam("dispatcher", "reload_delta", 1) This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. - Example 1.43. ds_select_dst usage + Example 1.44. ds_select_dst usage ... ds_select_dst("1", "0"); ... @@ -1123,7 +1152,7 @@ ds_select_dst("1", "$var(a)"); ds_select_dst("1", "4", "3"); ... - Example 1.44. configuring load balancing with congestion detection + Example 1.45. configuring load balancing with congestion detection ... # sample of SQL provisionning statements INSERT INTO "dispatcher" @@ -1177,7 +1206,7 @@ DEST: { This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. - Example 1.45. ds_select_domain usage + Example 1.46. ds_select_domain usage ... $var(a) = 4; if(ds_select_domain("1", "$var(a)")) { @@ -1201,7 +1230,7 @@ if(ds_select_domain("1", "$var(a)")) { This function can be used from ANY_ROUTE. - Example 1.46. ds_select usage + Example 1.47. ds_select usage ... $var(a) = 4; if(ds_select("1", "$var(a)")) { @@ -1244,7 +1273,7 @@ if(ds_select("1", "$var(a)")) { This function can be used from ANY_ROUTE. - Example 1.47. ds_select_routes usage + Example 1.48. ds_select_routes usage ... $var(alg) = 4; $var(limit) = 8; @@ -1319,7 +1348,7 @@ failure_route[REROUTE] { This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. - Example 1.48. ds_mark_dst usage + Example 1.49. ds_mark_dst usage ... failure_route[tryagain] { ... @@ -1341,7 +1370,7 @@ failure_route[tryagain] { This function can be used from ANY_ROUTE. - Example 1.49. ds_list_exists usage + Example 1.50. ds_list_exists usage ... if(ds_list_exists("10")) { ... @@ -1385,7 +1414,7 @@ if(ds_list_exists("10")) { This function can be used from ANY_ROUTE. - Example 1.50. ds_is_from_list usage + Example 1.51. ds_is_from_list usage ... if(ds_is_from_list()) { ... @@ -1419,7 +1448,7 @@ if(ds_is_from_list("10", "3", "sip:127.0.0.1:5080")) { This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE and ONREPLY_ROUTE. - Example 1.51. ds_load_unset usage + Example 1.52. ds_load_unset usage ... route { ... @@ -1717,7 +1746,7 @@ setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attrs(str,opt) For database, each element of a line resides in a different column. Next is a dispatcher.list file example: - Example 1.52. dispatcher list file + Example 1.53. dispatcher list file ... # # dispatcher destination sets (groups) @@ -1742,7 +1771,7 @@ r,opt) Next listing shows a sample config for using the dispatcher module. - Example 1.53. Kamailio config script - sample dispatcher usage + Example 1.54. Kamailio config script - sample dispatcher usage ... #!KAMAILIO #