Skip to content

Azure Web Job Singleton

We have one production issue where by our Azure Web Jobs are scale out to 2 instances.

Having 2 instance running, which mean it will run two of the .exe files.

And if your program is designed to be only single instance run, it will cause problems, you may observe that the log is messy when you wanna track it down.

To solve this issue, there are two ways:

  1. Refactor the code, always consider your program is scale-able, and writing the code to add a lock or something when processing logic.
  2. Add Singleton property in the Settings.

For option 2:

We could create a file called settings.job with the content: { “is_singleton”: true } and put it at the root of the WebJob directory.

After setting up, we can use web API to check, GET /api/continuouswebjobs/{job name}/settings.

Source: https://stackoverflow.com/a/40479371

Leave a Reply

Your email address will not be published. Required fields are marked *