Azure Functions 内存不足异常

Moo*_*rse 6 powershell out-of-memory azure azure-blob-storage azure-functions

我有一个 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)"
Run Code Online (Sandbox Code Playgroud)

通过使用 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
Run Code Online (Sandbox Code Playgroud)

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

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

你有什么建议吗?

Sat*_*a V 8

检查Function App的平台配置:

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

在此输入图像描述

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

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

  • 为什么这个答案不受欢迎,这解决了我们的一个大问题!多谢 !我们正在插入 100 万个对象,每个对象有 50 个属性 - 在本地控制台应用程序中成功运行,但在 azure 函数中总是失败。升级到64位,一切顺利 (2认同)