[Asterisk-Users] realtime excessive database queries

Adam Goryachev mailinglists at websitemanagers.com.au
Sun May 22 19:13:47 MST 2005


On Sun, 2005-05-22 at 18:44 -0700, snacktime wrote:
> On 5/22/05, Preston Garrison <preston at mailblocks.com> wrote:
>  The biggest problem is several routines
> > would need to be modified to pass around the data. It was just easier
> > to put hooks in all the functions for the database. Writing your own
> > database interface and caching the queries could do it as well.
> 
> I was thinking about using postgresql with odbc since postgresql has
> an interface to memcached which we use a lot anyways.  And with
> postgresql I could just use a few rules to rewrite the queries from
> asterisk and not have to touch the asterisk odbc code.  This also
> makes sense for us because we are already using postgresql with
> memcached for a bunch of other stuff.


Rather than caching the data, which would remember the data past it's
useby date (which is never a fixed value, the useby date is when the
data in the DB is modified, which could be at anytime!), we should
simply read the entire extension in a single select, and cache that
answer for the life of the channel, or until it moves to another
extension.

This will help assure that the extension is always in some consistent
state.... ie, it is either the old set of values, OR the new set, but
not going to start with the old set, get to priority 5, and suddenly
break because we changed things...

Just my 0.02c worth, or less, since I haven't even read the code.... 





More information about the asterisk-users mailing list