Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure functions static isolation

I haven't been able to find much documentation on the isolation of Azure functions in an app service plan.

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.

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.

like image 792
Alex KeySmith Avatar asked Jul 07 '17 10:07

Alex KeySmith


1 Answers

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

  • 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.

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.

like image 123
Mikhail Shilkov Avatar answered Oct 02 '22 23:10

Mikhail Shilkov