Re: Querying the database frequently. Any patterns?

From: Paul Campbell (p.au.l.ca.mp.b.ell_at_ob.jectvi.sion.c.o.u.k)
Date: 11/18/03


Date: Tue, 18 Nov 2003 18:37:56 -0000


"Ravi Shankar" <sujashankar@pacific.net.sg> wrote in message news:bpd***$df1$1@nobel2.pacific.net.sg...
> Hi all,
>
> I have a calendar application( like Microsoft Outlook) writtn in
> Java.Whenever an event is created, we can set SMS/EMAIL notification. Hence
> when an event is created, I am storing that event info and notification time
> into a database.Now the notification can be ranging from 5 minutes to say
> one day.Hence I need to query the databse every 5 minutes and fetch the data
> and do send the notification directly. I understand that such a querying of
> database every 5 minutes is a huge performance penalty.

Unlikely - it usually takes 10s or even 100s of simple queries a second to
cause problems.

> Can any body please
> suggest a better way to implement this? Any links please? Any patterns would
> be of use? Thanks a lot for the help.

Never use a database as an interface between two sub-systems - this is a well know
architectural anti-pattern: if thing A needs to know when something happens to thing
B then thing B should directly notify A somehow (direct function call/socket message/
messaging middleware etc etc).

Paul C.


Quantcast