Search code examples
.netwindowsiisbackground-processhangfire

Hangfire processing load when using with IIS, what process is taxed?


I'm running windows server 2012 with IIS 8.5, I need to run some long running background tasks and I want to avoid taxing IIS with backgroundtasks. I find it a bit unclear what processes Hangfire is taxing when running its tasks. Is it running pure windows threads? Or is it still using the same IIS threads as my webapps are using (and thus slowing down IIS and making it unstable).

Thanks!


Solution

  • If you're running your background server from your web application, then it's running these background jobs within the IIS process, as you suspect.
    It does, however, use different threads to those processing the requests, so shouldn't affect the performance of your main application.

    If you do find it causes a problem, you can always run the background server in a console application, totally outside of IIS.

    This has additional benefits of horizontal scaling - You could have multiple servers running this console app, pointing at the same queue.