问题描述
我是Azure Web工作的新手.当我使用网络作业时,我想到一个问题,即网络作业是否具有自己的内存分配(如进程)?
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?
我们正在网站(Web应用程序)下创建Web作业,因此将为网站创建一个单独的内存.然后我们在该网站下以天蓝色创建多个Web职位.
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.
因此,如果静态类在天蓝色的网站实例下得到实例化,那么同时使用该静态类的web-jobs是否会导致数据丢失?像这样
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
例如:
website --> static class1 memory instance get created.
In webjob1 --> uses above created class1.
In webjob2 --> uses above one class1.
Webjobs仅使用参考(浅拷贝)
Webjobs uses only reference(shallow copy)
或
由于webjob是一个进程,它将在自己的内存中创建静态类实例吗?
since webjob working as a process,it will create static class instance on its own memory?
例如:
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
推荐答案
每个WebJob均在其自己的进程中运行,该进程不同于WebApp的进程(w3wp).因此它们每个都有自己的静态变量副本.
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.
这篇关于Azure Webjobs是否有其自己的内存分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!