]> git.ipfire.org Git - thirdparty/asterisk.git/commit
main/stasis: Allow subscriptions to use a threadpool for message delivery
authorMatthew Jordan <mjordan@digium.com>
Mon, 1 Dec 2014 15:53:02 +0000 (15:53 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 1 Dec 2014 15:53:02 +0000 (15:53 +0000)
commit4588a0bc3c51f8b135f38fe69685055197072cc1
tree354bf8c7bb70fc1bb5bd821db3a14b050d99c59c
parentb05b9c5c6ceda0ae11f0fa8bb489421293b77bc4
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@428681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
26 files changed:
UPGRADE.txt
apps/app_queue.c
channels/chan_dahdi.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_sip.c
channels/chan_skinny.c
channels/sig_pri.c
configs/stasis.conf.sample [new file with mode: 0644]
include/asterisk/stasis.h
include/asterisk/stasis_internal.h
include/asterisk/stasis_message_router.h
main/endpoints.c
main/stasis.c
main/stasis_cache.c
main/stasis_channels.c
main/stasis_message_router.c
res/parking/parking_applications.c
res/parking/parking_bridge_features.c
res/res_jabber.c
res/res_pjsip_mwi.c
res/res_pjsip_pubsub.c
res/res_pjsip_refer.c
res/res_stasis_device_state.c
res/res_xmpp.c
tests/test_stasis.c