Azure功能静态隔离 [英] Azure functions static isolation

查看:84
本文介绍了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.

推荐答案

您可以通过拥有一个或多个功能应用程序来进行管理:

You can manage this by having one or many Function Apps:

  • 同一Function App的不同功能将在同一进程中运行,并将任何静态状态与在同一主机上运行的同一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的网站.在环境"选项卡上,您可以看到计算机名称,因此可以检查两个应用程序是否在同一计算机上运行.然后,在进程资源管理器"选项卡上,您将看到分配给特定功能应用程序的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功能静态隔离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆