8

How much LOCAL DISK is available to a single execution of an Azure Function.

According to this issue https://github.com/Azure/Azure-Functions/issues/179, the locations D:\local and the HOME environment variable should be writable.

I want to know how much space is available for each function to work with, or what the recommended strategy for using System.IO based file writes are for temporary files.

JJS
  • 6,431
  • 1
  • 54
  • 70

2 Answers2

6

Just ran this code on my Function App:

foreach (DriveInfo drive in DriveInfo.GetDrives().Where(d => d.IsReady))
{
    log.Info($"{drive.Name}: {drive.TotalFreeSpace / 1024 / 1024} MB");
}

and got

C:\: 457665 MB
D:\: 1511 MB

I guess no document will tell you the exact number, but you can use mine as estimate. I'm running on Consumption plan.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • thx @Mikhail. How much space do you have allocated in the File Service associated with this Azure Functions app? I know that the max memory available to a Function instance is 1.5gb. I wonder if they're doing a memory-mapped drive for D:\, and then putting the code in there... – JJS Jul 24 '17 at 17:29
  • @JJS I think there's no such setting while creating a Function App. – Mikhail Shilkov Jul 24 '17 at 17:33
  • 1
    https://github.com/Azure/Azure-Functions/issues/179 > They can use the HOME environment variable to get to their local directory. If using the Consumption plan, this will be backed by Azure Storage. https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#how-the-consumption-plan-works > When you use the Consumption hosting plan, function code files are stored on Azure Files shares on the main storage account. I believe this is saying the File Service is for storing the definition, but it is not mounted at execution time for persistent storage. – JJS Jul 24 '17 at 17:40
5

When you function app is in consumption plan, The data is d:\ comes from the file share of you associated Azure storage account. You can find the storage account information from the AzureWebJobsStorage Application Settings under the Platform features tab in portal and the file share information is preset in WEBSITE_CONTENTSHARE Application settings.

When your function app is on App Service plan it uses the default App Service Storage.

You can find the more information on Quota's and limitations at this link

From above documentation Consumption plan (Storage File Share) it is 5 TB and for App Service plan it depends on the plan under which your app is, but it ranges from 1-500 GB.

Naren
  • 847
  • 4
  • 7