Eric Lyons
2005-Nov-02 17:25 UTC
[Asterisk-Users] RealTime extensions - why so many SELECTs per call?
Just got realtime working in 1.2.0-beta2 and I'm wondering why there are so
many sql selects for a call.
My extensions.conf:
[test-realtime]
switch => RealTime/test-realtime@${EXTEN}
The extensions table in the db contains one record:
mysql> select * from extensions;
+----+---------------+-------------+----------+------+--------------+
| id | context | exten | priority | app | appdata |
+----+---------------+-------------+----------+------+--------------+
| 1 | test-realtime | 18669999999 | 1 | Dial | IAX2/creeble |
+----+---------------+-------------+----------+------+--------------+
and when a call comes into that switch, I get NINE queries into mysql, of which
the first four are identical:
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten = '18669999999' AND context =
'test-realtime' AND priority = '-1'
SELECT * FROM extensions WHERE exten LIKE '\_%' AND context =
'test-realtime' AND priority = '-1' ORDER BY exten
SELECT * FROM extensions WHERE exten = 'h' AND context =
'test-realtime' AND priority = '1'
SELECT * FROM extensions WHERE exten LIKE '\_%' AND context =
'test-realtime' AND priority = '1' ORDER BY exten
Can anybody explain what's going on there?
Eric.
Brian Capouch
2005-Nov-02 17:32 UTC
[Asterisk-Users] RealTime extensions - why so many SELECTs per call?
Eric Lyons wrote:> > Can anybody explain what's going on there? >I cannot, but I do know it is normal behavior, and there isn't anything (for now) that can be done to reduce the number of such queries. You might want to check the -users and -dev archives; this isn't a new topic. . . B.
Eric Lyons
2005-Nov-03 10:30 UTC
[Asterisk-Users] Re: RealTime extensions - why so many SELECTs per call?
Hmm, yes, lots of comments about this problem. Doesn't seem like
there's a near-term solution, which makes realtime extensions (at
least) rather unscalable.
I think I'll hack at app_addon_mysql.c and make my extensions.conf like:
[incoming]
exten=>_.,1,LookupStuff(${EXTEN})
exten=>_.,2,Whatever...
Eric.