[Home]

Summary:ASTERISK-08778: realtime optimisation
Reporter:burvinkle burvinkle (burvinkle)Labels:
Date Opened:2007-02-11 16:18:05.000-0600Date Closed:2007-03-27 15:07:18
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:i must say that i found maybe bug in asterisk.

His choosing of best extension is not optimal .

My example :

for example i have such extensions

_10.,1,Dial(SIP/${exten})
_101,1,Dial(SIP/${exten:1})
11111,1,Dial(SIP/${exten})

If i make call to 11111 - asterisk will check the database and return only one extension 11111,1,Dial(SIP/${exten}) to asterisk , And a call will porceed.


If i make a call to number 10000 asterisk will try to find exact exten. But after that - it will load every extension . And engine will choose optimal.
It is not problem for those who have ont much extensions in realtime configuration . BUT. If you have about 5000 extensions you will have a problem . Because asterisl will load all extensions from database ( it takes time about 5-10 seconds ) , and only after that -- the call will porceed.
Comments:By: Steve Murphy (murf) 2007-02-13 08:44:11.000-0600

I've been doing work to speed up the core (see the branch team/murf/fast-ast)
(it's in conflict at the moment).

At any rate, how to apply this to a situation where the dialplan is stored in a db may be interesting... Perhaps the trees could be stored in a memory area outside the db, and recalculated if anything in the trees change... this may not be easy to do, but would change the algorithm so that only the target extension would be loaded, about constant speed no matter how big the dialplan.

By: burvinkle burvinkle (burvinkle) 2007-02-14 07:54:46.000-0600

If "about constant speed no matter how big the dialplan" how can i increase it?

Now i found the way to do so. And make some changes. But i have lost in codes. If you point me on plase where to make changes - i`ll make them by myself.

I have trouble.
I changed the algorithm and insert "INSERTED select" in my query . I put it in exten variable. But my "INSERTED select" have symbol ' and to database request sends as \'  - escaped.

HOw can i find not to escape some sequences such as symbol '?

thanks for your answer.

By: Steve Murphy (murf) 2007-03-27 15:07:18

OK, I had an idea of a way to optimize RT to do faster extension matching in RT, but kpfleming assured me that it couldn't work because of the way RT is architected.

Says kpfleming:

 "This is impossible because you have no way of knowing when the database
 is modified. Even if you did, you'd have to resort to rebuilding the
 'search tree' in memory, and if the dialplan is large enough then the
 other issue comes into the picture as well.

 "This is an artifact of the way the Realtime system is architected, which
 means that it is broken. It is not fixable in the current architecture."

So, for time being, until RT is re-written, there is nothing that can be done.
Sorry to say this, but such is life.