[Asterisk-code-review] Taskprocessors: Increase high-water mark (asterisk[certified/13.1])

Joshua Colp asteriskteam at digium.com
Fri Nov 13 15:01:39 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: Taskprocessors: Increase high-water mark
......................................................................


Taskprocessors: Increase high-water mark

In practical tests, we have seen certain taskprocessors, specifically
Stasis subscription taskprocessors, cross the recently-added high-water
mark and emit a warning. This high-water mark warning is only intended
to be emitted when things have tanked on the system and things are
heading south quickly. In the practical tests, the Stasis taskprocessors
sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
any danger at all.

As such, this ups the high-water mark to 500 tasks instead. It also
redefines the SIP threadpool request denial number to be a multiple of
the taskprocessor high-water mark.

Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
---
M include/asterisk/taskprocessor.h
M main/taskprocessor.c
M res/res_pjsip/pjsip_distributor.c
3 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/include/asterisk/taskprocessor.h b/include/asterisk/taskprocessor.h
index 0636886..6ebf072 100644
--- a/include/asterisk/taskprocessor.h
+++ b/include/asterisk/taskprocessor.h
@@ -56,6 +56,8 @@
 
 struct ast_taskprocessor;
 
+#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL 500
+
 /*!
  * \brief ast_tps_options for specification of taskprocessor options
  *
diff --git a/main/taskprocessor.c b/main/taskprocessor.c
index cdac2c8..c8897c6 100644
--- a/main/taskprocessor.c
+++ b/main/taskprocessor.c
@@ -714,8 +714,6 @@
 	return NULL;
 }
 
-#define HIGH_WATER_LEVEL 100
-
 /* push the task into the taskprocessor queue */
 static int taskprocessor_push(struct ast_taskprocessor *tps, struct tps_task *t)
 {
@@ -736,7 +734,7 @@
 	AST_LIST_INSERT_TAIL(&tps->tps_queue, t, list);
 	previous_size = tps->tps_queue_size++;
 
-	if (previous_size >= HIGH_WATER_LEVEL && !tps->high_water_warned) {
+	if (previous_size >= AST_TASKPROCESSOR_HIGH_WATER_LEVEL && !tps->high_water_warned) {
 		ast_log(LOG_WARNING, "The '%s' task processor queue reached %d scheduled tasks.\n",
 			tps->name, previous_size);
 		tps->high_water_warned = 1;
diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index 32f6154..ea7419b 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -245,7 +245,7 @@
 	.on_rx_request = endpoint_lookup,
 };
 
-#define SIP_MAX_QUEUE 500L
+#define SIP_MAX_QUEUE (AST_TASKPROCESSOR_HIGH_WATER_LEVEL * 3)
 
 static pj_bool_t distributor(pjsip_rx_data *rdata)
 {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list