views:

244

answers:

2

Hello All,

I have a web application that has a long running (resource intensive) process in the code behind and the end output is a pdf file (images to pdf conversion tool)

It runs fine..and since I am on a dedicated server, it is not at all a problem with respect to resources right now.

However, I wonder that the system would reach its resource limits if, there are more than 20 users processing at a time.

I have seen services online where the user enters their email and the processes are, I suppose, queued in the background and the results emailed with the 1st in 1st out method.

Can someone please give me a start on how to implement this kind of logic in asp.net applications using C#?

Thanks a lot in advance,

Prasad.

+5  A: 

Such a system would consist of a windows service running on the server. The only thing the asp.net page does is to submit a request (with the relevant data) to the database. The windows service then monitors this table and processes all new requests.

klausbyskov
A: 

You want to throttle the number of concurrent requests. You can create a separate application to handle the conversion process. Either a windows service or a scheduled task that runs at a regular interval.

  1. Log the requests to a queue, either to a database table or to MSMQ. You'll want to log it to some queue in case something happens with the program. Since you are going to handle the processes asynchronously, the user will never know if something went wrong, besides never receiving the file. This way you can restart the process if something happens and continue processing.
  2. Have the external application monitor the queue and processes request one at a time.
  3. When the process is finished notify the user the process is done and can download it at the web site, or just email the pdf to the user.

The great part about having an external program handle the conversion is that you can load the program on multiple machines to process the requests faster, and it/they don't have to slow down your web/app servers used to handle the website.

Kevin
Thank you for your reply.please excuse me if I understood it wrong.1. So I create an win service that lets say takes as input the image locations and email address and outputs the location of the pdf file.2. When a request is submitted from the web interface, I log the image locations and email address into a database. and lets say also a column saying finished or not. I donot understand how to do your 2nd point.How do you have the windows service to MONITOR the database?Can you lead me to a tutorial or give me a snippet?Thanks a lot in advance,Prasad.