]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Optimize how Stasis forwards are dispatched
authorDavid M. Lee <dlee@digium.com>
Mon, 30 Sep 2013 18:39:34 +0000 (18:39 +0000)
committerDavid M. Lee <dlee@digium.com>
Mon, 30 Sep 2013 18:39:34 +0000 (18:39 +0000)
commit9d21631aeeade117fda1a2feddbbb13b4dbcca69
treeedf97cee9283ee56c8a5afd76a90b731deab5f88
parente88afe2022cf92500d77968c0bb1d5c4cbd76ade
Optimize how Stasis forwards are dispatched

This patch optimizes how forwards are dispatched in Stasis.

Originally, forwards were dispatched as subscriptions that are invoked
on the publishing thread. This did not account for the vast number of
forwards we would end up having in the system, and the amount of work it
would take to walk though the forward subscriptions.

This patch modifies Stasis so that rather than walking the tree of
forwards on every dispatch, when forwards and subscriptions are changed,
the subscriber list for every topic in the tree is changed.

This has a couple of benefits. First, this reduces the workload of
dispatching messages. It also reduces contention when dispatching to
different topics that happen to forward to the same aggregation topic
(as happens with all of the channel, bridge and endpoint topics).

Since forwards are no longer subscriptions, the bulk of this patch is
simply changing stasis_subscription objects to stasis_forward objects
(which, admittedly, I should have done in the first place.)

Since this required me to yet again put in a growing array, I finally
abstracted that out into a set of ast_vector macros in
asterisk/vector.h.

Review: https://reviewboard.asterisk.org/r/2883/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
16 files changed:
apps/app_queue.c
include/asterisk/stasis.h
include/asterisk/vector.h [new file with mode: 0644]
main/cdr.c
main/cel.c
main/channel_internal_api.c
main/manager.c
main/manager_bridges.c
main/manager_channels.c
main/manager_mwi.c
main/manager_system.c
main/stasis.c
main/stasis_cache_pattern.c
res/stasis/app.c
tests/test_stasis.c
tests/test_stasis_endpoints.c