mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
taskprocessors: Implement high/low water mark alerts.
When taskprocessors get backed up, there is a good chance that we are being overloaded and need to defer adding new work to the system. * Implemented a high/low water alert mechanism for modules to check if the system is being overloaded and take appropriate action. When a taskprocessor is created it has default congestion levels set. A taskprocessor can later have those congestion levels altered for specific needs if stress testing shows that the taskprocessor is a symptom of overloading or needs to handle bursty activity without triggering an overload alert. * Add CLI "core show taskprocessor" low/high water columns. * Fixed __allocate_taskprocessor() to not use RAII_VAR(). RAII_VAR() was never a good thing to use when creating a taskprocessor because of the nature of how its references needed to be cleaned up on a partial creation. * Made res_pjsip's distributor check if the taskprocessor overload alert is active before placing a message representing brand new work onto a distributor serializer. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I182f1be603529cd665958661c4c05ff9901825fa
This commit is contained in:
@@ -59,6 +59,7 @@ struct ast_taskprocessor;
|
||||
/*! \brief Suggested maximum taskprocessor name length (less null terminator). */
|
||||
#define AST_TASKPROCESSOR_MAX_NAME 45
|
||||
|
||||
/*! Default taskprocessor high water level alert trigger */
|
||||
#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL 500
|
||||
|
||||
/*!
|
||||
@@ -297,4 +298,26 @@ const char *ast_taskprocessor_name(struct ast_taskprocessor *tps);
|
||||
*/
|
||||
long ast_taskprocessor_size(struct ast_taskprocessor *tps);
|
||||
|
||||
/*!
|
||||
* \brief Get the current taskprocessor high water alert count.
|
||||
* \since 13.10.0
|
||||
*
|
||||
* \retval 0 if no taskprocessors are in high water alert.
|
||||
* \retval non-zero if some task processors are in high water alert.
|
||||
*/
|
||||
unsigned int ast_taskprocessor_alert_get(void);
|
||||
|
||||
/*!
|
||||
* \brief Set the high and low alert water marks of the given taskprocessor queue.
|
||||
* \since 13.10.0
|
||||
*
|
||||
* \param tps Taskprocessor to update queue water marks.
|
||||
* \param low_water New queue low water mark. (-1 to set as 90% of high_water)
|
||||
* \param high_water New queue high water mark.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error (water marks not changed).
|
||||
*/
|
||||
int ast_taskprocessor_alert_set_levels(struct ast_taskprocessor *tps, long low_water, long high_water);
|
||||
|
||||
#endif /* __AST_TASKPROCESSOR_H__ */
|
||||
|
||||
Reference in New Issue
Block a user