views:

23

answers:

1

I'm trying to set a reminder in a system to fire at a certain time.

This is a web based app, so it's not like it will be in memory all the time.

Ideally I'd like to avoid using a service or job on the server(mainly out of curiosity, to see if there is a more efficient way to do it)

For example, imagine how many Ebay bids are constantly ending all the times, and emails being sent out seemingly perfectly in time.

Do people recon there is just a big loop going over and over, moving items into a queue etc... Or is there something lower level helping out (stored procedures, triggers etc)

Thanks everyone.

A: 

What you have to realize about eBay - and most large database-backed websites - is that the interactions between humans and the database that come through the web server are only a part (sometimes a very small part) of the functionality of the system.

To use eBay as an example, the email that goes out when auctions expire is not handled by a web server. They are far more likely to have that scripted. In other words, there is another program running on a number of their systems that look at the database for ended auctions, do some processing on them, send emails, etc.

If I were doing something similar (albeit on a much smaller scale,) I'd have my web services built in the usual way, but have a job that is run automatically every few minutes to do the maintenance work. It would start up, look at the database for work, process anything that was required, then exit.

Cool, thats exactly what I planned to do as well, which dosen't seem like to bad a system. I just thought there might be some way to bind things to points in time. Hmmm maybe I could have a process that looked through the db every hour or day, and cached the actions that had to happen. Then that could be looped through much more efficently, and you just rebuild the cache every hour(at a guess, could be a day as well). Then if anything went wrong you haven't lost any in memory info, but while it works you get less db loops.
optician