views:

170

answers:

2

I want to add quartz scheduling to an ASP.NET application.

It will be used to send queued up emails.

What are the pros and cons of running quartz.net as windows service vs embedded.

My main concern is how Quartz.NET in embedded mode handles variable number of worker processes in IIS.

+1  A: 

Quartz.NET can be instantiated on a per-application basis (web farm configuration mandates number of schedulers). You can safely run multiple schedulers if you have your jobs backed in a database and you have Quartz.NET configured in clustered mode (and clocks synced naturally).

The main concern is to the application pool handling prior to IIS 7.5. Without constant checks your application worker can get recycled and your scheduler will be down until someone issues a web request to fire up the application pool again. IIS 7.5 has the new feature to keep application pools running all the time.

Otherwise there should not be a big difference between the two models.

Marko Lahma
+2  A: 

Here are some things to you can consider while you decide whether you should run embedded or not:

  1. If you are going to be creating jobs ONLY from within the hosting application, then run embedded. Otherwise, run as a service.

  2. If your jobs might need permissions that are different from the permissions that the web app has, run as a service.

  3. If your jobs are long running jobs, or jobs that use a lot memory, run as a service.

  4. If you need to run your jobs in a clustered environment for either performance, scalability or fault tolerance, run as a service.

From the items above you can deduce that my preference is to run it as a service. This is because if you are going to go through the trouble of setting up a job scheduler, this means that you have jobs that need to run on a schedule, or long running jobs. A service is usually the better choice for this type of work.

TskTsk