I am trying to make a reminder system, and I use quartz for my planning. However, I came up with a couple of possible ways to do what I need to do, but I'm not sure what the best way is and how to test it.
Basically, I have a reminder system in which users can set reminders. This is similar to Google Calendar. You set the date and time of your event, and then you set a reminder saying "remind me 15 minutes before"
So, you could host the event on May 10, 2011, 9:59, and you could remind me β15 minutes beforeβ
So it will be May 10, 10:44.
I will be in a hosted environment. (My site and planning will work in the same environment and even in the same solution. Therefore, it cannot significantly slow down users browsing my site.)
I also use nhibernate and free nhibernate to execute a db request. I am using asp.net mvc 3 for my website.
Option 1.
Make a database request every minute and get all reminders that should be sent this minute. This, of course, would mean a database query every minute and probably too intense for the general environment.
Option 2
Run a database query every 5 minutes and grab all the reminders that should be sent to this 5 minute block and store them in a collection (so that memory), and then check every minute which ones should be sent.
This, of course, reduces the number of queries made, but I'm not sure that it will be extremely intense.
Option 3
Same as Option 2, but send a request every 15 minutes and save it in the collection.
This, of course, means much less database queries, but more is stored in memory.
Option 4
Run a database query every 15 minutes and get all reminders in this block and run them immediately.
This means that they will not be stored in memory for a very long time and reduce the number of requests. However, depending on when the user is set up for the reminder, the email may be sent earlier than they were set.
For example, they said to remind me at 10:44. I would plan for my planner to start at 10:00, and it would snap from 10:00 to 10:15, and then from 10:15 to 10:30, and then from 10:30 to 10:45.
So the email will actually arrive 14 minutes earlier than anticipated.