[Asterisk-code-review] pjsip: Rewrite OPTIONS support with new eyes. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Sun Jan 21 13:39:13 CST 2018


Hello Richard Mudgett, Jenkins2, Corey Farrell, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/7710

to look at the new patch set (#2).

Change subject: pjsip: Rewrite OPTIONS support with new eyes.
......................................................................

pjsip: Rewrite OPTIONS support with new eyes.

The OPTIONS support in PJSIP has organically grown, like
many things in Asterisk. It has been tweaked, changed, and
adapted based on situations run into. Unfortunately this has
taken its toll. Configuration file based objects have poor
performance and even dynamic ones aren't that great.

This change scraps the existing code and starts fresh
with new eyes. It leverages all of the APIs made available
such as sorcery observers and serializers to provide a
better implementation.

1. The state of contacts, AORs, and endpoints relevant to
the qualify process is maintained. This state can be updated
by external forces (such as a device registering/unregistering)
and also the reload process. This state also includes the
association between endpoints and AORs.

2. AORs are scheduled and not contacts. This reduces the amount
of work spent juggling scheduled items.

3. Manipulation of which AORs are being qualified and the
endpoint states all occur within a serializer to reduce the
conflict that can occur with multiple threads attempting to
modify things.

4. Operations regarding an AOR use a serializer specific to that
AOR.

5. AORs and endpoint state act as state compositors. They take
input from lower level objects (contacts feed AORs, AORs feed
endpoint state) and determine if a sufficient enough change has
occurred to be fed further up the chain.

6. Realtime is supported by using observers to know when a contact
has been registered. If state does not exist for the associated
AOR then it is retrieved and becomes active as appropriate.

The end result of all of this is best shown with a configuration file
of 3000 endpoints each with an AOR that has a static contact. In
the old code it would take over a minute to load and use all 8 of
my cores. This new code takes 2-3 seconds and barely touches the
CPU even while dealing with all of the OPTIONS requests.

ASTERISK-26806

Change-Id: I6a5ebbfca9001dfe933eaeac4d3babd8d2e6f082
---
M funcs/func_pjsip_contact.c
M include/asterisk/res_pjsip.h
M res/res_pjsip/location.c
M res/res_pjsip/pjsip_configuration.c
M res/res_pjsip/pjsip_options.c
5 files changed, 1,999 insertions(+), 1,417 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/7710/2
-- 
To view, visit https://gerrit.asterisk.org/7710
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6a5ebbfca9001dfe933eaeac4d3babd8d2e6f082
Gerrit-Change-Number: 7710
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180121/95563950/attachment.html>


More information about the asterisk-code-review mailing list