JR Richardson
2007-Jan-14 12:08 UTC
[asterisk-users] realtime mysql db performance difference with matching extensions
Hi All, I'm testing different ways to implement a LCR/OCN tabe to shift calls to multiple carriers for better rates. I'm using realtime mysql database access, asterisk 1.2.9.1 with mysql 3.23. Scenario 1: I send outgoing calls with with a Goto statement into the context with the realtime switch to dip into the mysql lcr database, currently I have ~13K records/routes. The database records have matching exten like this _1504555XXXX Scenario 2: I send outgoing calls with a Goto statement into a context that does a realtime database lookup for a route and extracts the appdata from the record, put that into a Dial statement to complete the call like this exten => _1NXXNXX,1,RealTime(lcr|exten|${EXTEN:1}|LCR_) exten => _1NXXNXX,2,GotoIf($["${LCR_exten}" = ""]?${EXTEN},105:${EXTEN},3) exten => _1NXXNXX,3,Set(directdial=${LCR_exten}@${LCR_appdata}) exten => _1NXXNXX,4,NoOp(${directdial}) exten => _1NXXNXX,5,NoOp(${TIMESTAMP}) the database has records with 504555, this is just a test setup The performance difference is substantial, scenario 1 takes 2-3 seconds to complete with the mysql and asterisk combined process taking 100% processor utilization for the 2-3 second duration. Scenario 2 takes less than a second, completes immediately with little resource use. So the question is: is the extension matching routing in asterisk normally a high resource user with a realtime switch to a mysql database? Is the resource use a product of the database having 13K records? I'm more inclined to believe the extens matching is the culprit here, not the size of the database. Any thoughts/advice/alternative methods, other experience implementing LCR tables with asterisk? Thanks. JR -- JR Richardson Engineering for the Masses