0

I have an Azure Function App running on Linux Consumption Plan with a storage file share mounted with the CLI command

az webapp config storage-account add --resource-group <resgroupname> --name <functionappname> --storage-type AzureFiles --share-name <filesharename> --account-name <storageaccountname> --mount-path /sharedata --access-key <accesskey>

In this file share there is a folder with 200-250 mb data that is needed for one of the functions. Copying from /sharedata to /tmp takes only a few ms if done in public override void Configure(IFunctionsHostBuilder builder) in Startup class for entire Function app. However, since only one function needs the data I would rather have the copying done first thing in the function needing it. But then the exact same code that copies a directory recursively takes 15-20 seconds to complete.

Is this expected behavior? I can't find anything in the docs I've read (quite a lot of ground to cover there) that could serve as an explanation. The copy code uses standard c# System.IO functions for listing and copying dirs and files.

1 Answers1

0
  • Yes, it is an expected behavior as you might see slow performance when you try to transfer files to Azure file share.

You might see slow performance when you try to transfer files to the Azure File service.

  • If you don't have a specific minimum I/O size requirement, we recommend that you use 1 MiB as the I/O size for optimal performance.

  • If you know the final size of a file that you are extending with writes, and your software doesn't have compatibility problems when the unwritten tail on the file contains zeros, then set the file size in advance instead of making every write an extending write.

  • As you are mentioning that you are using large size file you can try using AzCopy instead of Azure file share.

You can also use AzCopy to copy one file to another or to copy a blob to a file or the other way around. See Get started with AzCopy.

  • You can Refer these Documents for complete information.
  1. Azure File Storage from Azure Function.
  2. Azure files writes speed consistently slower
  3. Copy Data from App service
SaiSakethGuduru
  • 2,218
  • 1
  • 5
  • 15
  • I don't transfer to a file share, I transfer from a (mounted) file share to `/tmp` folder. What I don't understand is why it's very fast during Startup but very slow when executed inside the function. It is also very slow to run the executable from the mountes file share, that's why it is being copied. – CalculationCycle Apr 22 '22 at 13:43