Files
asterisk/configs/samples/stasis.conf.sample

137 lines
5.1 KiB
Plaintext
Raw Permalink Normal View History

taskpool: Add taskpool API, switch Stasis to using it. This change introduces a new API called taskpool. This is a pool of taskprocessors. It provides the following functionality: 1. Task pushing to a pool of taskprocessors 2. Synchronous tasks 3. Serializers for execution ordering of tasks 4. Growing/shrinking of number of taskprocessors in pool This functionality already exists through the combination of threadpool+taskprocessors but through investigating I determined that this carries substantial overhead for short to medium duration tasks. The threadpool uses a single queue of work, and for management of threads it involves additional tasks. I wrote taskpool to eliminate the extra overhead and management as much as possible. Instead of a single queue of work each taskprocessor has its own queue and at push time a selector chooses the taskprocessor to queue the task to. Each taskprocessor also has its own thread like normal. This spreads out the tasks immediately and reduces contention on shared resources. Using the included efficiency tests the number of tasks that can be executed per second in a taskpool is 6-12 times more than an equivalent threadpool+taskprocessor setup. Stasis has been moved over to using this new API as it is a heavy consumer of threadpool+taskprocessors and produces a lot of tasks. UpgradeNote: The threadpool_* options in stasis.conf have now been deprecated though they continue to be read and used. They have been replaced with taskpool options that give greater control over the underlying taskpool used for stasis. DeveloperNote: The taskpool API has been added for common usage of a pool of taskprocessors. It is suggested to use this API instead of the threadpool+taskprocessor approach.
2025-08-06 13:19:20 -03:00
[taskpool]
;minimum_size = 5 ; Minimum number of taskprocessors in taskpool.
;initial_size = 5 ; Initial size of the taskpool.
; ; 0 means the taskpool has no taskprocessors initially
; ; until a task needs a taskprocessor.
;idle_timeout_sec = 20 ; Number of seconds a taskprocessor should be idle before
; ; dying. 0 means taskprocessors never time out.
;max_size = 50 ; Maximum number of taskprocessors in the Stasis taskpool.
; ; 0 means no limit to the number of taskprocessors in the
; ; taskpool.
main/stasis: Allow subscriptions to use a threadpool for message delivery Prior to this patch, all Stasis subscriptions would receive a dedicated thread for servicing published messages. In contrast, prior to r400178 (see review https://reviewboard.asterisk.org/r/2881/), the subscriptions shared a thread pool. It was discovered during some initial work on Stasis that, for a low subscription count with high message throughput, the threadpool was not as performant as simply having a dedicated thread per subscriber. For situations where a subscriber receives a substantial number of messages and is always present, the model of having a dedicated thread per subscriber makes sense. While we still have plenty of subscriptions that would follow this model, e.g., AMI, CDRs, CEL, etc., there are plenty that also fall into the following two categories: * Large number of subscriptions, specifically those tied to endpoints/peers. * Low number of messages. Some subscriptions exist specifically to coordinate a single message - the subscription is created, a message is published, the delivery is synchronized, and the subscription is destroyed. In both of the latter two cases, creating a dedicated thread is wasteful (and in the case of a large number of peers/endpoints, harmful). In those cases, having shared delivery threads is far more performant. This patch adds the ability of a subscriber to Stasis to choose whether or not their messages are dispatched on a dedicated thread or on a threadpool. The threadpool is configurable through stasis.conf. Review: https://reviewboard.asterisk.org/r/4193 ASTERISK-24533 #close Reported by: xrobau Tested by: xrobau ........ Merged revisions 428681 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428687 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-01 17:59:21 +00:00
[declined_message_types]
; This config section contains the names of message types that should be prevented
; from being created. By default, all message types are allowed to be created.
;
; Using this functionality requires knowledge of the names of internal stasis
; message types which is generally the same as the name of the accessor function.
;
; Use of this functionality may break more complex functionality in Asterisk
; such as CEL, CDR, transfers, etc. and will likely cause related messages in ARI
; and AMI to go missing.
; decline=stasis_app_recording_snapshot_type
; decline=stasis_app_playback_snapshot_type
; decline=stasis_test_message_type
; decline=confbridge_start_type
; decline=confbridge_end_type
; decline=confbridge_join_type
; decline=confbridge_leave_type
; decline=confbridge_start_record_type
; decline=confbridge_stop_record_type
; decline=confbridge_mute_type
; decline=confbridge_unmute_type
; decline=confbridge_talking_type
; decline=cel_generic_type
; decline=ast_bridge_snapshot_type
; decline=ast_bridge_merge_message_type
; decline=ast_channel_entered_bridge_type
; decline=ast_channel_left_bridge_type
; decline=ast_blind_transfer_type
; decline=ast_attended_transfer_type
; decline=ast_endpoint_snapshot_type
; decline=ast_endpoint_state_type
; decline=ast_device_state_message_type
; decline=ast_test_suite_message_type
; decline=ast_mwi_state_type
; decline=ast_mwi_vm_app_type
; decline=ast_format_register_type
; decline=ast_format_unregister_type
; decline=ast_manager_get_generic_type
; decline=ast_parked_call_type
; decline=ast_channel_snapshot_type
; decline=ast_channel_dial_type
; decline=ast_channel_varset_type
; decline=ast_channel_hangup_request_type
; decline=ast_channel_dtmf_begin_type
; decline=ast_channel_dtmf_end_type
; decline=ast_channel_flash_type
; decline=ast_channel_wink_type
; decline=ast_channel_hold_type
; decline=ast_channel_unhold_type
; decline=ast_channel_chanspy_start_type
; decline=ast_channel_chanspy_stop_type
; decline=ast_channel_fax_type
; decline=ast_channel_hangup_handler_type
; decline=ast_channel_moh_start_type
; decline=ast_channel_moh_stop_type
; decline=ast_channel_mixmonitor_start_type
; decline=ast_channel_mixmonitor_stop_type
; decline=ast_channel_agent_login_type
; decline=ast_channel_agent_logoff_type
; decline=ast_channel_talking_start
; decline=ast_channel_talking_stop
; decline=ast_channel_tone_detect
; decline=ast_security_event_type
; decline=ast_named_acl_change_type
; decline=ast_local_bridge_type
; decline=ast_local_optimization_begin_type
; decline=ast_local_optimization_end_type
; decline=stasis_subscription_change_type
; decline=ast_multi_user_event_type
; decline=stasis_cache_clear_type
; decline=stasis_cache_update_type
; decline=ast_network_change_type
; decline=ast_system_registry_type
; decline=ast_cc_available_type
; decline=ast_cc_offertimerstart_type
; decline=ast_cc_requested_type
; decline=ast_cc_requestacknowledged_type
; decline=ast_cc_callerstopmonitoring_type
; decline=ast_cc_callerstartmonitoring_type
; decline=ast_cc_callerrecalling_type
; decline=ast_cc_recallcomplete_type
; decline=ast_cc_failure_type
; decline=ast_cc_monitorfailed_type
; decline=ast_presence_state_message_type
; decline=ast_rtp_rtcp_sent_type
; decline=ast_rtp_rtcp_received_type
; decline=ast_call_pickup_type
; decline=aoc_s_type
; decline=aoc_d_type
; decline=aoc_e_type
; decline=dahdichannel_type
; decline=mcid_type
; decline=session_timeout_type
; decline=cdr_read_message_type
; decline=cdr_write_message_type
; decline=cdr_prop_write_message_type
; decline=corosync_ping_message_type
; decline=agi_exec_start_type
; decline=agi_exec_end_type
; decline=agi_async_start_type
; decline=agi_async_exec_type
; decline=agi_async_end_type
; decline=queue_caller_join_type
; decline=queue_caller_leave_type
; decline=queue_caller_abandon_type
; decline=queue_member_status_type
; decline=queue_member_added_type
; decline=queue_member_removed_type
; decline=queue_member_pause_type
; decline=queue_member_penalty_type
; decline=queue_member_ringinuse_type
; decline=queue_agent_called_type
; decline=queue_agent_connect_type
; decline=queue_agent_complete_type
; decline=queue_agent_dump_type
; decline=queue_agent_ringnoanswer_type
; decline=meetme_join_type
; decline=meetme_leave_type
; decline=meetme_end_type
; decline=meetme_mute_type
; decline=meetme_talking_type
; decline=meetme_talk_request_type
; decline=appcdr_message_type
; decline=forkcdr_message_type
; decline=cdr_sync_message_type