Queuing using table or MSMQ?
Posted
by Lieven Cardoen
on Stack Overflow
See other posts from Stack Overflow
or by Lieven Cardoen
Published on 2010-03-23T10:51:50Z
Indexed on
2010/03/23
10:53 UTC
Read the original article
Hit count: 239
A part of the application I'm working on is an swf that shows a test with some 80 questions. Each question is saved to a sql server through WebORB and asp.net. If a candidate finisheds the test, the session needs to be validated. Problem now is that sometimes 350 candidates finish their test at the same moment, and cpu on webserver and sql server explodes (350 validations concurrently).
Now, how would I implement queuing here? In the database, there's a table that has a record for each session. One column holds the status. 1 is finished, 2 is validated.
I could implement queuing in two ways (as I see it, maybe you have other propositions):
- A process that checks the table for records with status 1. If it finds one, it validates the session. So, sessions are validated one after one.
- If a candidate finishes its session, a message is sent to a MSMQ queue. Another process listens to the queue and validates sessions one after one.
Now,
- What would be the best approach?
- Where do you start the process that will validate sessions? In your global.asax (application_start)? As a windows service? As an exe on the root of the website that is started in application_start?
To me, using the table and looking for records with status 1 seems the easiest way.
© Stack Overflow or respective owner