Azure Functions 内存不足异常

标签 azure powershell azure-functions out-of-memory azure-blob-storage

我有一个 Azure Functions Powershell 核心,如下所示:

# Input bindings are passed in via param block.
param([byte[]] $InputBlob, $TriggerMetadata)

# Write out the blob name and size to the information log.
Write-Host "PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes  Uri: $($TriggerMetadata.Uri)"

通过使用 Blob 触发器,我想使用 Powershell 从 Azure Blob 读取 VDH 操作系统镜像并将其转换为托管磁盘。图像大小为30GB。当函数被触发时,我得到下面的System.OutOfMemoryException:

2020-09-07T09:52:44.704 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=93b00718-9941-4379-abd0-348137cdcff2, Duration=56449ms)Exception of type 'System.OutOfMemoryException' was thrown.
2020-09-07T09:52:45.061 [Information] Stopping JobHost

我增加了应用程序计划以获得 14GB 内存,但我遇到了相同的内存异常。

当我直接从 Cloud Shell 执行此操作时,我成功,但我的主要目标是使用 自动化脚本 Blob 触发器

你有什么建议吗?

最佳答案

检查Function App的平台配置:

功能 -> 配置 -> 常规设置 -> 平台

enter image description here

32 位的私有(private)字节数较少,并且即使实例具有更多容量,也可能会遇到内存不足异常。

如果您遇到这种情况,建议您升级到64 位

关于Azure Functions 内存不足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63775341/

相关文章:

c# - 如何验证Azure负载均衡器?

azure - 没有足够的权限将 Azure Active Directory 权限分配给启用了 MSI 的 Azure 功能?

configuration - 如何在 dotnet-isolated (net5.0) azure 函数中使用 IOptions 模式进行配置

c# - Azure Functions 中的 DbContext 池

c# - Cosmos DB 返回 404

javascript - 使用 AAD MSAL 登录 - 登录已在进行中

c# - System.Timers.Timer在Azure辅助角色中徘徊

powershell - 我可以将 TLS 与 Send-MailMessage cmdlet 一起使用吗?

powershell - PowerShell 脚本中的 Get-ChildItem 权限被拒绝错误

powershell - Azure使用powershell如何获取实例计数