asterisk/res/res_pjsip
Matthew Jordan 9cc1a8e893 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
2014-06-13 18:24:49 +00:00
..
include res_pjsip: Enable PJSIP DNS client support. 2014-03-17 22:54:32 +00:00
config_auth.c pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup. 2014-03-08 16:50:36 +00:00
config_domain_aliases.c res_pjsip: Updates and adds more PJSIP CLI commands. 2014-02-06 17:55:45 +00:00
config_global.c res_pjsip: Updates and adds more PJSIP CLI commands. 2014-02-06 17:55:45 +00:00
config_system.c Prevent duplicate sorcery wizards from being applied to sorcery object types. 2014-04-02 18:57:29 +00:00
config_transport.c Allow Asterisk to compile under GCC 4.10 2014-05-09 22:49:26 +00:00
location.c Allow Asterisk to compile under GCC 4.10 2014-05-09 22:49:26 +00:00
pjsip_cli.c pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup. 2014-03-08 16:50:36 +00:00
pjsip_configuration.c stasis: Reduce creation of channel snapshots to improve performance 2014-06-13 18:24:49 +00:00
pjsip_distributor.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
pjsip_global_headers.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
pjsip_options.c res_pjsip: Handle reloading when permanent contacts exist and qualify is configured. 2014-04-17 22:50:23 +00:00
pjsip_outbound_auth.c res_pjsip: Ignore 401/407 responses for transactions and dialogs we don't know about. 2013-12-19 18:00:33 +00:00
presence_xml.c Improve XML sanitization in NOTIFYs, especially for presence subtypes and messages. 2014-05-07 15:29:18 +00:00
security_events.c Remove unused RAII_VAR() declarations. 2014-04-15 18:01:47 +00:00