Schneur,

Thank you for this suggestion. It is an interesting idea and I should have 
thought of it before.
However, this solution would not operate in quite the way as I was planning.
My list contains black-listed destinations, so we hope that 99.999% of calls 
will be legitimate users and the destination will not be blacklisted.
Your method would therefore require one of the following:
a) Cache the result for *every* destination prefix with an associated value 
showing if it is white or black
b) For every call make several unsuccessful queries on both the local cache and 
the DB table - just what I wish to avoid

Solution (a) would need a cache whose size could not easily be predicted 
beforehand. However, it should work if a large cache is assigned and the least 
often used entries in that cache are dropped to make space for new prefixes 
when it becomes full.

For future reference, I am also interested to know if there is a better way to 
load data from a DB table into a local cache and to know if the limit of 100 
that I discovered is a constraint of AVP's or a constraint of avp_db_query or 
something else.

John Quick
Smartvox Limited
Tel:   01727-221221


From: Schneur Rosenberg [mailto:rosenberg11...@gmail.com] 
Sent: 20 February 2016 05:41
To: OpenSIPS users mailling list <users@lists.opensips.org>; 
john.qu...@smartvox.co.uk
Subject: Re: [OpenSIPS-Users] Best way to load data into local cache

Why don't u use avp_db_query on demand and cache the info so u don't need to 
run this particular query again?
On Feb 19, 2016 4:47 PM, "John Quick" <mailto:john.qu...@smartvox.co.uk> wrote:
Using version 2.1.1 of OpenSIPS
I want to load several hundred records into local cache memory on startup.
I've tried avp_db_query to read all data into an avp, then a loop to write
it from the avp into cache memory, but it can only do 100 records at a time.
Is this simply a limitation of all avp's?

Is there another way, a better way?

Why do I want to do this? Because I want to check each INVITE ruri
destination username against a list of known "suspicious" destination
prefixes (perhaps 1000 records). Each call may require several checks
because the list contains prefixes of varying lengths. I am concerned that
queries made directly to the MySQL table as each INVITE request is received
could impair performance and would put constant unwanted load on the MySQL
server.

John Quick
Smartvox Limited
Web: http://www.smartvox.co.uk



_______________________________________________
Users mailing list
mailto:Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to