[asterisk-dev] PJSIP realtime scalability problem
Michael Ulitskiy
mulitskiy at acedsl.com
Sat Oct 17 10:03:47 CDT 2015
Matthew,
Thanks for the reply.
Yes I do have caching enabled. While caching does somewhat help (there are different problems there)
with ongoing load it has nothing to do with initial load that is still done in the extremely inefficient way
I described in my original email.
Caching also doesn't help at all with CLI commands like "pjsip show endpoints" in which case asterisk
reloads the whole list from db instead of showing what it has in-memory.
Also I've noticed another very awkward problem. If I type "pjsip show endpoint" in the console and then
press "Tab" then asterisk hangs for over a minute and I register over 300 queries like this in the db log:
SELECT * FROM pjsip_endpoints_v WHERE id LIKE '%' ORDER BY id
Why would asterisk need to load the whole list of endpoints more than 300 times is just completely beyond me.
For a long time it was my understanding that "dynamic realtime" means loading data from db on demand.
What pjsip does now is not a dynamic realtime. What it does seems like the mix of both worlds: static realtime in the beginning -
loading everything from db and dynamic afterwords - issuing queries whenever it needs endpoint data (caching helps here).
Unless I'm missing something and there's a another/better way to use it, I think pjsip realtime is not usable now
at any scale other than very trivial one.
Thanks,
Michael
On Friday, October 16, 2015 03:51:49 PM Matthew Jordan wrote:
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151017/dd660472/attachment-0001.html>
More information about the asterisk-dev
mailing list