Well,<div>I think for best_match, I think it's main use is routing lookups. I could see a variant of it that can handle subnet matching as well. After all, the whole point is to detect and rewrite, right?</div><div><br>
</div><div>So in general, I don't see best_match doing a whole lot other than routing.. I can tell you, I'd probably also use it for rating and costing in realtime. But likewise, it'd be the kind of thing I take a dialed number or the ANI and look for a best match pattern to retrieve the route, cost, or rate. For ANI, you could use it for RPID pattern enforcement. I think it would be a good addition. It would allow for the creation of a lot of applications based on the memory caching backend.</div>
<div><br></div><div>As for using an external store, I think it's a great idea. However, scriptwriters need to remember that memcache isn't meant to be a reliable data store. So it's important that people write their scripts with that in mind. In other words, you always check the cache for a value, and if it isn't there, then load the cache with the value from the database. It's got to be ok for the cache to be empty. Preloading the cache should always be an option as well (especially for larger datastores with higher cardinality).</div>
<div><br></div><div>I suppose best_match could be done in a while loop in script.. but honestly, I think that's pretty messy. I think it would be a good addition.</div><div><br></div><div>Thanks for your consideration. :)</div>
<div>-Brett</div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Tue, May 26, 2009 at 10:54 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Brett,<br>
<br>
The idea of having "families / classes/ groups" for cached values is indeed a nice and useful one. I will love to have this in the next release.<br>
<br>
But regarding the "best_match" do you think there is any other application for it except the routing part?<br>
<br>
An idea that I would like to explore is how to use an external cache server (like memcached) during t restarts to avoid the penalty of going through the db (save and load) - like you restart opensips, but the memory content stays the same.<br>
<br>
Regards,<br>
Bogdan<br>
<br>
Brett Nemeroff wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey All,<br>
I just had this revelation today about a potential feature and I wanted to run it by the group to see if there was any interest in it. I tried posting it to the tracker, but <a href="http://sf.net" target="_blank">sf.net</a> <<a href="http://sf.net" target="_blank">http://sf.net</a>> keeps failing (I'm getting server busy messages.. grumble..)<div>
<div></div><div class="h5"><br>
<br>
So I had talked before about "memcache families". This is where you can store data into separate memcache namespaces. This would be useful to store and purge large sets for data at one time..<br>
<br>
Think for a minute about routes being loaded into memcache....<br>
<br>
Say for example, if I had 10 customers. Each with their own unique route table with 3 million records each. As one table, that would be 30 million total routes.. Which may be slow to traverse (not sure, haven't tested). However if each route table is in it's own family (ie: namespace in memcache) it would only be 3 million. Which should be very fast. Also, if I'm changing just one route, I wouldn't have to purge my entire memcache store to update it.. just the one route table effected.. Also, I use memcache to store my IP to account relationships.. so we don't need those to reload either.. That's the idea of memcache families; only update the family that makes sense. It would only add one additional option to the cache_store and cache_fetch functions (family). And would also add a function cache_family_purge, which would delete an entire family of data.<br>
<br>
Now building on that idea is my next feature request (which really doesn't depend on memcache families, but it makes sense to combine the two):<br>
This is a request for the ability to "find_best_match" in memcache family. This is a function that you'd pass a memcache family to and it would take the input value (say $rU for example) and keep removing a character from it until it hit a match and then return the cached value. Of course, this also depends on preloaded cache values. Which I'd load from an external script upon startup.<br>
Function usage would be like this: find_best_match("<memcache_storage_engine>","<memcache_family_name>","<value_to_search_with>",<avp_to_recieve_results>) <br>
There is a *ton* that can be done with this.. My mind is spinning. :) ie: return 1.2.3.4_<prefix> Then use the transformations to pull the prefix out and push it into the $rU.. Very powerful.. And you wouldn't even need custom modules anymore for routing.<br>
<br>
So if the dialed number is 5125551212 and in memcache I have: 512555 -> 1.2.3.4 It would hit memcache like this: if (find_best_match("local","$avp(s:routetable)","$rU",$avp(s:routestring))) { $rD = $(avp(s:routestring){s.select,0,_}); # rewrite destination $rU = $rU + $(avp(s:routestring){s.select,1,_}); # add prefix if defined } else { sl_send_reply("404","No Route"); exit; } 5125551212 -> No Match 512555121 -> No Match 51255512 -> No Match 5125551 -> No Match 512555 -> 1.2.3.4<br>
Thanks for your consideration and feedback!!<br>
-Brett<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div>