I am new to using Hangfire and looking for some guidance here. When I am running a background Job from Asp.Net Web Application, the Job runs in the same context of IIS.
If the Job is scheduled to run at every 10 seconds are there any performance hit?
As per the documentation it is mentioned Hangfire is built to run background Jobs from Web Application. Are there any recommendations around if there are multiple always running background Jobs we are better off running them outside of IIS?
Also would like to know on the differences of running them inside IIS and outside in terms of memory consumption?
Hangfire currently cannot run a job every 10 seconds, the minimal resolution is 1 minute. The less the resolution, the more performance hit would be.
If you have an always running job, you don’t actually need a job scheduler for that: just start a separate thread and throttle it to whatever resolution you like. This way there won’t be any overhead of constant database polling for new jobs.
In terms of memory, the hosting process doesn’t really matter. If your job consumes 100Mb of memory, it would add 100Mb regardless of running in IIS or in a separate process. Bare IIS worker process is not much different from any other process, and would definitely pale in comparison to a memory used by your code.
Thanks for providing your input.
We are planning to run 10-15 jobs from Hangfire which will be scheduled to run every one minute.
Any recommendations around that what needs to be considered?