简体   繁体   English

在 Function 中从挂载共享复制文件比在启动中慢得多

[英]Copying file from mounted share much slower in Function than in Startup

I have an Azure Function App running on Linux Consumption Plan with a storage file share mounted with the CLI command我有一个 Azure Function 应用程序在 Linux 消费计划上运行,并使用 CLI 命令安装存储文件共享

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.在此文件共享中,有一个文件夹包含其中一项功能所需的 200-250 MB 数据。 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.如果在 Startup class 中对整个 Function 应用程序在public override void Configure(IFunctionsHostBuilder builder)中完成,从 /sharedata 复制到 /tmp 只需要几毫秒。 However, since only one function needs the data I would rather have the copying done first thing in the function needing it.但是,由于只有一个 function 需要数据,所以我宁愿在需要它的 function 中首先完成复制。 But then the exact same code that copies a directory recursively takes 15-20 seconds to complete.但是递归复制目录的完全相同的代码需要 15-20 秒才能完成。

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.复制代码使用标准 c# System.IO 函数列出和复制目录和文件。

  • Yes, it is an expected behavior as you might see slow performance when you try to transfer files to Azure file share.是的,这是预期的行为,因为当您尝试将文件传输到 Azure 文件共享时,您可能会看到性能下降。

You might see slow performance when you try to transfer files to the Azure File service.当您尝试将文件传输到 Azure 文件服务时,您可能会发现性能下降。

  • 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.如果您没有特定的最小 I/O 大小要求,我们建议您使用 1 MiB 作为 I/O 大小以获得最佳性能。

  • 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.正如您提到的,您使用的是大文件,您可以尝试使用AzCopy而不是 Azure 文件共享。

You can also use AzCopy to copy one file to another or to copy a blob to a file or the other way around.您还可以使用 AzCopy 将一个文件复制到另一个文件,或将 blob 复制到文件,或反之。 See Get started with AzCopy .请参阅AzCopy 入门

  • You can Refer these Documents for complete information.您可以参考这些文档以获取完整信息。
  1. Azure File Storage from Azure Function . Azure 来自 Azure Function 的文件存储
  2. Azure files writes speed consistently slower Azure 文件写入速度一直较慢
  3. Copy Data from App service从应用服务复制数据

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Redshift Spectrum 比 Athena 慢得多? - Redshift Spectrum much slower than Athena? pkg/sftp 比 Linux SCP 慢得多,为什么? - pkg/sftp Much Slower than Linux SCP, Why? 为什么两个通道上的 select 比单通道上的 select 慢两倍? - Why is select on two channel much slower than 2x of the time to select on single channel? Redshift 设计或配置问题? - 我的 Redshift 数据仓库似乎比我的 mysql 数据库慢得多 - Redshift design or configuration issue? - My Redshift datawarehouse seems much slower than my mysql database 当应用程序托管在 windows VM 中的 IIS 上时,无法将文件复制到 Azure 文件共享安装的驱动器 - Not able to copy file to Azure file share mounted drive when application hosted on IIS in windows VM 文件资源管理器在尝试访问时挂起已安装 Azure Windows 10 桌面上的文件共享 - File Explorer hangs when trying access Mounted Azure File share on Windows 10 Desktop 为什么来自 Firebase 存储的缓存图像比其他存储慢? - Why are cached images from Firebase Storage slower than others? Creating a csv file on an Azure File share from a list that is created in a C# Azure Function - Creating a csv file on an Azure File share from a list that was created in a C# Azure Function Azure 容器在启动时无法访问已安装的卷,为什么? - Azure container can't access a mounted volume on startup why? GCP 将文件从我的本地机器复制到 GCP Vm - GCP Copying File from my local Machine to GCP Vm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM