]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Taskprocessors: Increase high-water mark 23/1623/1
authorMark Michelson <mmichelson@digium.com>
Fri, 13 Nov 2015 20:19:35 +0000 (14:19 -0600)
committerMark Michelson <mmichelson@digium.com>
Fri, 13 Nov 2015 20:33:20 +0000 (15:33 -0500)
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

include/asterisk/taskprocessor.h
main/taskprocessor.c
res/res_pjsip/pjsip_distributor.c

index 06368867a8f309d24666b1a7941d6fa3380a4108..6ebf0729cc7669dba73f071578787eee42291f67 100644 (file)
@@ -56,6 +56,8 @@
 
 struct ast_taskprocessor;
 
+#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL 500
+
 /*!
  * \brief ast_tps_options for specification of taskprocessor options
  *
index eefa85f6162cb2165d33758f7d6fd366b6975c96..7c50089f284d29f6ace05a3015e7da48893f1313 100644 (file)
@@ -713,8 +713,6 @@ void *ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
        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)
 {
@@ -735,7 +733,7 @@ static int taskprocessor_push(struct ast_taskprocessor *tps, struct tps_task *t)
        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;
index c40f7f9eddb4eadd7e95448fec1165678700fdab..0e0e90f4e96d47879f26c9890f4fbb86946b94c6 100644 (file)
@@ -246,7 +246,7 @@ static pjsip_module endpoint_mod = {
        .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)
 {