summaryrefslogtreecommitdiff
path: root/main/channel_internal_api.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-06-13 18:24:49 +0000
committerMatthew Jordan <mjordan@digium.com>2014-06-13 18:24:49 +0000
commit9cc1a8e8936760a44def12c30329d6284f4139a8 (patch)
tree00cb0fb5904021052c0b9b6c6bc5c97e008be21f /main/channel_internal_api.c
parent0acc6265303822e0c5b4044d8152f38896fdbe83 (diff)
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local channels, we noticed that there's quite a hit in performance during channel creation and releasing to the dialplan (ARI continue). After investigating the performance spike that occurs during channel creation, we discovered that we create a lot of channel snapshots that are technically unnecessary. This includes creating snapshots during: * AGI execution * Returning objects for ARI commands * During some Local channel operations * During some dialling operations * During variable setting * During some bridging operations And more. This patch does the following: - It removes a number of fields from channel snapshots. These fields were rarely used, were expensive to have on the snapshot, and hurt performance. This included formats, translation paths, Log Call ID, callgroup, pickup group, and all channel variables. As a result, AMI Status, "core show channel", "core show channelvar", and "pjsip show channel" were modified to either hit the live channel or not show certain pieces of data. While this is unfortunate, the performance gain from this patch is worth the loss in behaviour. - It adds a mechanism to publish a cached snapshot + blob. A large number of publications were changed to use this, including: - During Dial begin - During Variable assignment (if no AMI variables are emitted - if AMI variables are set, we have to make snapshots when a variable is changed) - During channel pickup - When a channel is put on hold/unhold - When a DTMF digit is begun/ended - When creating a bridge snapshot - When an AOC event is raised - During Local channel optimization/Local bridging - When endpoint snapshots are generated - All AGI events - All ARI responses that return a channel - Events in the AgentPool, MeetMe, and some in Queue - Additionally, some extraneous channel snapshots were being made that were unnecessary. These were removed. - The result of ast_hashtab_hash_string is now cached in stasis_cache. This reduces a large number of calls to ast_hashtab_hash_string, which reduced the amount of time spent in this function in gprof by around 50%. #ASTERISK-23811 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3568/ ........ Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel_internal_api.c')
-rw-r--r--main/channel_internal_api.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 9cc99f3d5..0c5117e6d 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -943,9 +943,8 @@ void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
ast_channel_name(chan),
call_identifier_to,
call_identifier_from);
-
- ast_channel_publish_snapshot(chan);
}
+
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
chan->state = value;
@@ -1073,7 +1072,6 @@ void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
{
chan->whentohangup = *value;
- ast_channel_publish_snapshot(chan);
}
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
{
@@ -1131,7 +1129,6 @@ ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->callgroup = value;
- ast_channel_publish_snapshot(chan);
}
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
{
@@ -1140,7 +1137,6 @@ ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->pickupgroup = value;
- ast_channel_publish_snapshot(chan);
}
struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan)
{