[asterisk-dev] PJSIP realtime scalability problem

Matthew Jordan mjordan at digium.com
Fri Oct 16 15:51:49 CDT 2015


On Thu, Oct 15, 2015 at 10:58 AM, Michael Ulitskiy <mulitskiy at acedsl.com> wrote:
> Hello,
>
>
>
> I have a system consisting of OpenSIPS proxy, working as registrar and
> outbound proxy for subscribers and multiple
>
> asterisk systems behind it providing all kind of media services to
> subscribers. OpenSIPS proxy dynamically assigns
>
> which asterisk a particular endpoint should be served at and then forwards
> all messages from that endpoint to the
>
> selected asterisk server. Since this is dynamic process there's no
> predefined list of endpoints assigned to each asterisk server.
>
> Each asterisk server must be prepared to handle requests from any endpoint.
>
> Currently I'm using chan_sip with dynamic realtime and it works well.
> Whenever a request arrives to an asterisk it retrieves that
>
> endpoint (peer) from db and caches it. chan_sip never attempts to retrieve
> the whole list of endpoints.
>
>
>
> Now I'm considering migrating to chan_pjsip and immediately I encountered a
> problem. Unlike chan_sip, pjsip is retrieving
>
> the whole list of subscribers multiple times during initial load. Then it
> does it again every time you issue "pjsip list/show endpoints/aors"
>
> CLI commands. Even worse (much worse), after initial load of AORs and
> endpoints with the queries that looks like this:
>
>
>
> SELECT * FROM pjsip_aors_v WHERE id LIKE '%' ORDER BY id
>
> SELECT * FROM pjsip_endpoints_v WHERE id LIKE '%' ORDER BY id
>
>
>
> it follows on with loading every AOR individually with queries like this:
>
>
>
> SELECT * FROM pjsip_aors_v WHERE id = 'ep1'
>
> SELECT * FROM pjsip_aors_v WHERE id = 'ep2'
>
> ...
>
> SELECT * FROM pjsip_aors_v WHERE id = 'epN'
>
>
>
> Then it goes on with loading every endpoint individually with queries like
> this:
>
>
>
> SELECT * FROM pjsip_endpoints_v WHERE id = 'ep1'
>
> SELECT * FROM pjsip_endpoints_v WHERE id = 'ep2'
>
> ...
>
> SELECT * FROM pjsip_endpoints_v WHERE id = 'epN'
>
>
>
> I currently have around 10K of endpoints and it's completely unacceptable
> even at my scale and I'm sure there are much
>
> bigger installations out there.
>
>
>
> I asked this question on asterisk-users already
> (http://lists.digium.com/pipermail/asterisk-users/2015-October/287742.html)
>
> and was told by Joshua Colp that this is how things stands now and it works
> as intended.
>
>
>
> So I would like to ask developers if there are any plans to address it and
> make it behave more like chan_sip does. If no
>
> I'd like to know how developers suggest the installations with larger number
> of endpoints to handle this. I'm open to any
>
> suggestions. Right now it looks like show-stopper to me.
>

Hi Michael:

Have you tried sorcery caching yet?

https://wiki.asterisk.org/wiki/display/AST/Sorcery+Caching

It is new in 13.5.0, and was designed explicitly for this kind of
scenario. It probably didn't exist when Josh answered you on the
-users list, but I would take a look at putting a cache in
sorcery.conf for your PJSIP endpoints.

Matt

-- 
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list