1
votes

I am considering using Azure WebJobs to send an email to customers every morning. However, i want to be sure only one email is sent to each customer. I'm unclear if a scheduled Azure WebJob will run one-per-instance or one-per-webapp or one-per-deployment-slot. If I publish a webjob and schedule it to run every day at 8 am, and the site is configured with two deployment slots, and runs on 2 instances, how many emails will be sent to a customer at 8 am?

  • Is it 1, indicating Azure ensures only one webjob runs per schedule?
  • Is it 2, indicating Azure runs the webjob once on each instance or slot?
  • Or Is it 4, indicating Azure runs the webjob once on each instance on each slot?
1
"If your web app runs on more than one instance, a continuously running WebJob will run on all of your instances. On-demand and scheduled WebJobs run on a single instance selected for load balancing by Microsoft Azure." Source: azure.microsoft.com/en-us/documentation/articles/…Fabrizio Accatino
Ah, swear I read that page 3 times before posting and missed that somehow. Tells me what I need though. Thanks.Daniel
Well, except that it doesn't really address deployment slots. I'm thinking it would have to be one-per-deployment-slot if I understand the configuration correctly...Daniel

1 Answers

2
votes

Scheduled Azure WebJob will run once per schedule no matter how many instances the Website has.

Regarding slots, when you create a scheduled WebJob you actually create a triggered WebJob (on the Azure Website side) and a scheduler job (on the Azure Scheduler side). So you would create this once for the production slot, next you would deploy the same WebJob binaries as an "on demand" WebJob on your staging slot.

Whenever you swap Azure scheduler will still point to your production slot so it will always hit the WebJob that is currently deployed to the production slot.