Azure functions static isolation(Azure 函数静态隔离)
问题描述
我找不到太多关于在应用服务计划中隔离 Azure 功能的文档.
I haven't been able to find much documentation on the isolation of Azure functions in an app service plan.
如果您在 azure 函数调用之间共享一个静态变量,例如 HttpClient,我认为通读可扩展性建议,它可以在同一进程或单独进程中运行,或者单独的服务器...这很好,使用 Lazy<T> 可以帮助解决线程问题.
If you share a static variable for example an HttpClient between azure function invocations I presume reading through the scalability suggestions that it could run in the same process or separate processes or separate servers... which is fine, using Lazy<T> can help with threading issues.
但是单独的 Azure Functions 可以共享一个工作进程吗?即我应该隔离静态变量以确保功能隔离吗?我收集使用带有函数键的 ConcurrentDictionary 是帮助解决此问题的好方法,但我没有找到任何讨论隔离的文档.
But could separate Azure Functions share a worker process? i.e. should I isolate static variables to ensure isolation of the functions? I gather using a ConcurrentDictionary with a key for the function is a good approach to help solve this, but I haven't found any documentation that discusses isolation.
推荐答案
您可以通过拥有一个或多个 Function Apps 来管理:
You can manage this by having one or many Function Apps:
同一个Function App的不同功能将在同一个进程中运行,并且将与在同一主机上运行的同一个应用的其他功能重用任何静态状态.
Different functions of the same Function App will be running in the same process and will reuse any static state with other functions of the same app running on the same host.
不同功能应用的功能相互隔离.
Functions of different Function Apps are isolated from each other.
要直观地看到这一点,您可以访问 Kudu(每个应用程序的).在 Environment 选项卡上,您会看到一个机器名称,因此您可以检查两个应用程序是否在同一台机器上运行.然后,在 Process Explorer 选项卡上,您将看到分配给特定 Function App 的 w3wp.exe 进程.
To see that visually you may go to Kudu (of each app). On Environment tab you see a machine name, so you may check that two apps are running on the same machine. Then, on Process Explorer tab you will see a w3wp.exe process assigned to a specific Function App.
这篇关于Azure 函数静态隔离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Azure 函数静态隔离
基础教程推荐
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
