stasis: Segment channel snapshot to reduce creation cost.
authorJoshua Colp <jcolp@digium.com>
Wed, 7 Nov 2018 17:18:34 +0000 (13:18 -0400)
committerJoshua Colp <jcolp@digium.com>
Mon, 26 Nov 2018 18:56:24 +0000 (12:56 -0600)
commit50ac85cb40812be44d851316f007c1d935969096
tree1b31147a967aa2da5f14d03135b99ce64bbb8015
parentd0ccbb3377cffc66519ca3c8819d06b36556177d
stasis: Segment channel snapshot to reduce creation cost.

When a channel snapshot was created it used to be done
from scratch, copying all data (many strings). This incurs
a cost when doing so.

This change segments the channel snapshot into different
components which can be reused if unchanged from the
previous snapshot creation, reducing the cost. In normal
cases this results in some pointers being copied with
reference count being bumped, some integers being set,
and a string or two copied. The other benefit is that it
is now possible to determine if a channel snapshot update
is redundant and thus stop it before a message is published
to stasis.

The specific segments in the channel snapshot were split up
based on whether they are changed together, how often they
are changed, and their general grouping. In practice only
1 (or 0) of the segments actually get changed in normal
operation.

Invalidation is done by setting a flag on the channel when
the segment source is changed, forcing creation of a new
segment when the channel snapshot is created.

ASTERISK-28119

Change-Id: I5d7ef3df963a88ac47bc187d73c5225c315f8423
32 files changed:
apps/app_queue.c
channels/chan_pjsip.c
channels/pjsip/cli_commands.c
configs/samples/ari.conf.sample
configs/samples/manager.conf.sample
include/asterisk/channel.h
include/asterisk/stasis_channels.h
main/bridge.c
main/cdr.c
main/cel.c
main/channel.c
main/channel_internal_api.c
main/cli.c
main/core_local.c
main/endpoints.c
main/manager.c
main/manager_bridges.c
main/manager_channels.c
main/stasis_bridges.c
main/stasis_channels.c
pbx/pbx_realtime.c
res/ari/resource_bridges.c
res/ari/resource_channels.c
res/parking/parking_applications.c
res/parking/parking_bridge_features.c
res/res_chan_stats.c
res/res_pjsip/pjsip_configuration.c
res/res_pjsip_refer.c
res/res_stasis.c
res/stasis/app.c
tests/test_cel.c
tests/test_stasis_channels.c