3

I am new to Azure web-jobs. When I am working with web-jobs I have come up with an question that whether web-job have its own memory allocation like process?

we are creating web-jobs under website(web app) so for website a separate memory will get created.And then we are creating multiple web-jobs under that website in azure.

so if static class gets instanciated under azure website instance.then web-jobs which uses that static class concurrently,will leads to data loss? like this

eg:

website --> static class1 memory instance get created.     
In webjob1 --> uses above created class1.      
In webjob2 --> uses above one class1.  

Webjobs uses only reference(shallow copy)

or

since webjob working as a process,it will create static class instance on its own memory?

eg:

In webjob1 memory --> static class1 memory instance get created inside webjob1's allocated memory.    
In webjob2 memory --> static class1  memory  instance get created inside webjob1's allocated memory.etc...   
both have its own static class like(deep copy)

Can anyone explain how it works? thanks in advance

Skull
  • 1,204
  • 16
  • 28

1 Answers1

6

Each WebJob runs in its own process, which is distinct from the WebApp's process (w3wp). So they will each have their own copy of static variables.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • Thank you so much.if each webjobs have its own process and memory then why should we need to create it under website?. Azure will not allow us to create webjobs under Virtual Memory.If we want to create web jobs we need a web app. – Skull Jul 01 '16 at 03:28
  • 2
    You should view the Web App as a container for the WebJobs. You don't need to run an actual web site in there if you don't want to. – David Ebbo Jul 01 '16 at 03:54