[Asterisk-Users] realtime excessive database queries

snacktime snacktime at gmail.com
Sun May 22 23:35:56 MST 2005


> 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...

I agree that's a good idea.  However with a good cache mechanism you
don't have to worry about getting old data.  When you update the
database you delete that item from the cache, which forces the client
to get the new value from the database the next time it needs it.  Or
you tell the client somehow to reload the changed item.

Personally I would rather see realtime load everything into memory and
not go to the database unless something has changed or you reload. 
Then maybe add a new manager command like the following:

RealtimeReload(context|all,extension|all)

Which would trigger asterisk to reload from the database, locking
access to the context/extension until the reload was complete.

Another nice thing about this approach is that if your database (god
forbid) goes down, asterisk can keep humming along.

Chris



More information about the asterisk-users mailing list