Base solution for your next web application
Open Closed

Background Jobs & Azure App Service Scaled to Multiple Instances #11055


User avatar
0
FarReach created
  • What is your product version? 11.0.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .NET Core

We have an ASP.NET Zero application deployed to an Azure App Service and we have scaled out to multiple instances. However, now the background jobs are running multiple times...once for each instance. Based on articles we found, we switched our background job manager to utilize Hangfire, but that did not resolve the issue. As a result, users are receiving multiple of the same emails & SMS messages, etc.

A few items...

  • as noted, we are using Hangfire
  • we are utilizing an IQuartzScheduleJobManager to schedule jobs via ScheduleAsync method
  • audit logs indicating multiple instances of the backgrounds starting at the same exact time

How do limit background jobs to a single instance?

Is there documentation or any other guidance you can provide on how to configure background jobs in scenarios where the application is scaled out to multiple instances?


1 Answer(s)
  • User Avatar
    0
    FarReach created

    After further research, we determined it is not an issue with Hangfire. It appears to be an issue with Quartz. How do we configure Quartz to work in a cloud environment with multiple instances?