What’s the best way to persist a variable between Azure WebJob runs?

0
4
Asked By MellowCedar42 On

I'm still getting familiar with Azure Storage and need a simple, reliable way to save a variable's state between WebJob executions. I initially tried writing the value to a local file, but the process environment doesn't allow that. Should I use Blob Storage, Table Storage, or another Azure service?

3 Answers

Answered By BrightLynx63 On

It’s worth reconsidering whether a WebJob is the right host for a long-running process. Depending on how the job runs and how much state it needs, another Azure compute option or Durable Functions may be a better fit. Either way, don’t rely on the local file system for persistent state because the instance can be restarted or replaced.

Answered By CopperWillow18 On

Blob Storage or Table Storage can both work, depending on the data shape. Also consider Durable Functions if this is a long-running or asynchronous workflow, since they provide built-in patterns for tracking execution state instead of managing it manually.

Answered By QuartzHarbor7 On

For a single value, Blob Storage is probably the simplest option. Your WebJob can connect using the AzureWebJobsStorage connection string, load the current value when it starts, and save the updated value when it finishes. If you have several structured fields or many records, Table Storage is a better fit. A small state-store wrapper can keep the storage code clean.

MellowCedar42 -

Thanks, that clears things up. I’ll start with Blob Storage and use a small wrapper to load and save the value.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.