[asterisk-commits] app voicemail: Add taskprocessor alert level options. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 8 12:33:16 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: app_voicemail: Add taskprocessor alert level options.
......................................................................


app_voicemail: Add taskprocessor alert level options.

On heavy loaded system with IMAP or DB storage,
'app_voicemail' taskprocessor queue could reach 500 scheduled tasks.
It could happen when the IMAP or DB server dies or is unreachable.
It could happen on startup when there are many (thousands)
realtime endpoints configured with unsolicited mwi.
If the taskprocessor queue reaches the high water level
then the alert is triggered and pjsip stops processing new requests
until the queue reaches the low water level to clear the alert.

This patch adds 2 new 'general' configuration options
to tune taskprocessor alert levels:
'tps_queue_high' - Taskprocessor high water alert trigger level.
'tps_queue_low' - Taskprocessor low water clear alert level

ASTERISK-26229 #close

Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8
---
M CHANGES
M apps/app_voicemail.c
M configs/samples/voicemail.conf.sample
3 files changed, 42 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Verified



diff --git a/CHANGES b/CHANGES
index a43edab..3eadadf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -379,6 +379,17 @@
 
 
 ------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 13.11.0 to Asterisk 13.12.0 ----------
+------------------------------------------------------------------------------
+
+app_voicemail
+------------------
+ * Added "tps_queue_high" and "tps_queue_low" options.
+   The options can modify the taskprocessor alert levels for this module.
+   Additional information can be found in the sample configuration file at
+   config/samples/voicemail.conf.sample.
+
+------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.10.0 to Asterisk 13.11.0 ----------
 ------------------------------------------------------------------------------
 
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 894038b..4727e2e 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13532,6 +13532,8 @@
 	int x;
 	unsigned int tmpadsi[4];
 	char secretfn[PATH_MAX] = "";
+	long tps_queue_low;
+	long tps_queue_high;
 
 #ifdef IMAP_STORAGE
 	ast_copy_string(imapparentfolder, "\0", sizeof(imapparentfolder));
@@ -14107,6 +14109,25 @@
 			pagerbody = ast_strdup(substitute_escapes(val));
 		}
 
+		tps_queue_high = AST_TASKPROCESSOR_HIGH_WATER_LEVEL;
+		if ((val = ast_variable_retrieve(cfg, "general", "tps_queue_high"))) {
+			if (sscanf(val, "%30ld", &tps_queue_high) != 1 || tps_queue_high <= 0) {
+				ast_log(AST_LOG_WARNING, "Invalid the taskprocessor high water alert trigger level '%s'\n", val);
+				tps_queue_high = AST_TASKPROCESSOR_HIGH_WATER_LEVEL;
+			}
+		}
+		tps_queue_low = -1;
+		if ((val = ast_variable_retrieve(cfg, "general", "tps_queue_low"))) {
+			if (sscanf(val, "%30ld", &tps_queue_low) != 1 ||
+				tps_queue_low < -1 || tps_queue_high < tps_queue_low) {
+				ast_log(AST_LOG_WARNING, "Invalid the taskprocessor low water clear alert level '%s'\n", val);
+				tps_queue_low = -1;
+			}
+		}
+		if (ast_taskprocessor_alert_set_levels(mwi_subscription_tps, tps_queue_low, tps_queue_high)) {
+			ast_log(AST_LOG_WARNING, "Failed to set alert levels for voicemail taskprocessor.\n");
+		}
+
 		/* load mailboxes from users.conf */
 		if (ucfg) {	
 			for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
diff --git a/configs/samples/voicemail.conf.sample b/configs/samples/voicemail.conf.sample
index bb5f249..248e142 100644
--- a/configs/samples/voicemail.conf.sample
+++ b/configs/samples/voicemail.conf.sample
@@ -376,6 +376,16 @@
 ; defaults to being off
 ; backupdeleted=100
 
+; Asterisk Task Processor Queue Size
+; On heavy loaded system you may need to increase 'app_voicemail' taskprocessor queue.
+; If the taskprocessor queue size reached high water level, the alert is triggered.
+; If the alert is set then some modules (for example pjsip) slow down its production
+; until the alert is cleared.
+; The alert is cleared when taskprocessor queue size drops to the low water clear level.
+; The next options set taskprocessor queue levels for this module.
+; tps_queue_high=500	; Taskprocessor high water alert trigger level.
+; tps_queue_low=450	; Taskprocessor low water clear alert level.
+			; The default is -1 for 90% of high water level.
 
 [zonemessages]
 ; Users may be located in different timezones, or may have different

-- 
To view, visit https://gerrit.asterisk.org/3422
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list