Hello,
On 2/17/12 1:04 PM, Javier Gallart wrote:
could be, at least is the way I do prefix matching with mysql. Postgres, on the other hand, afaik, has an index plugin to match the longest prefix, might not be in default distro, but can be found on the net for sure.
Loading huge amount of records from mysql takes time indeed.
Maybe prefix matching will be added in redis in the future, or scripted server side in lua, as I understood it has such feature. Another option would be to add a custom command in kamailio like redis_cmd_pmatch() to do internally these prefix-based commands until a match, could simplify the config if it becomes something very popular.
Also, I forgot about the other solution in kamailio - pdb module written by 1&1 for number portability: * http://kamailio.org/docs/modules/stable/modules/pdb.html
Just mentioning it here for let it be known, if redis is working fine for you, makes no sense to look for other solutions.
Cheers, Daniel
HI Daniel
On Fri, Feb 17, 2012 at 1:44 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Yes, redis suppors LUA scripting through the EVAL command. Another possible approach would be to use pipelining. Instead of executing a query per prefix, redis offers has the feature of queing multiple commands and send them only once to the server. For example: redis 127.0.0.1:6379> multi OK redis 127.0.0.1:6379> "HGET" "tree:1000:routes" "3466157" QUEUED redis 127.0.0.1:6379> "HGET" "tree:1000:routes" "346615" QUEUED redis 127.0.0.1:6379> "HGET" "tree:1000:routes" "34661" QUEUED redis 127.0.0.1:6379> exec 1) (nil) 2) (nil) 3) "c=2000;q=100"
That way the iteration could take place in the result having issued a single command. For that, the redis module should support both multivalue responses.
I hadn't thought of using it, thanks for the tip. I will take a look.
Regards
Javi