[Asterisk-Dev] realtime iax2, non-unique realtime requests
steve at daviesfam.org
steve at daviesfam.org
Sun Oct 30 07:17:30 MST 2005
In realtime_peer in chan_iax2 is the possibility to lookup a peer by
ipaddr/port. This becomes "select * from table where ipaddr='a.b.c.d' and
port = '4569'"
This is used from iax2_getpeername where the peer isn't in memory.
iax2_getpeername is called, for instance, in find_callno.
Now there's no paticular requirement elsewhere that there be only one peer
registered from a particular ip/port.
I guess its usual, but in my test hookup, I'm registering 1000s of peers
from a single machine.
But: the select is a "big job" when it retrieves 1000s of rows. I see
that the mysql realtime interface reads all of those 1000s of rows,
creating ast_variables for every colum of every row. And then
realtime_peer reads through every single one of those 10s of 1000s of
variables to find the peername.
In my situation the peername is going to be a bit meaningless - just one
of the registered peers from that address. But I want to at least
optimize this to just fetch one row.
So: in the general case can I just add a "limit 1" to the generated SQL
statement in the realtime_func? (Obviously not in the
realtime_multi_func).
Thanks,
Steve
More information about the asterisk-dev
mailing list