4

Avoid Lock - Pointing Two WebJobs to The Same Azure Storage Account

 2 years ago
source link: https://www.getadigital.com/blog/avoid-lock---pointing-two-webjobs-to-the-same-azure-storage-account
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Avoid Lock - Pointing Two WebJobs to The Same Azure Storage Account

D

e

v

e

l

o

p

m

e

n

t

Valdis Iljuconoks

11/22/2021 2:12:19 PM

Recently we had a requirement to run multiple copies of our webjobs in parallel (with different settings and configuration) doing similar but different work.

azure.jpg

Yes yes, while the whole world around us is serverless (read "servers running on thin air"), we are still running on concrete servers and utilizing real CPUs.

Recently we had a requirement to run multiple copies of our webjobs in parallel (with different settings and configuration) doing similar but different work. Webjobs runtime uses Singleton lock approach to coordinate the execution of the job across the farm (if you have scaled-out your application). This is the way how runtime avoids duplicate executions of the same job. Webjobs runtime uses Azure storage blobs to accomplish a locking mechanism across multiple nodes in your cluster.

We wanted to skip extra storage account creation for the copy of the webjobs, but instead - we would like to use the same account because webjobs are doing completely different tasks and it's OK if they run simultaneously. But when you point both copies of the job to the same storage account one of the jobs will not be able to acquire the lock and therefore will stall until another job will release the lock.

We had to handle this somehow and workaround "single host" limitation.

Read more in my blog post: Avoid Lock - Pointing Two WebJobs to The Same Azure Storage Account


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK