Azure Functions 中存储帐户的昂贵使用 [英] Expensive use of storage account from Azure Functions

查看:11
本文介绍了Azure Functions 中存储帐户的昂贵使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在消费计划上运行单个 Azure 函数.我已经选择了无服务器功能的消费计划以及最小化成本.该函数使用来自服务总线主题的消息并将一些输出写入 blob 存储.

在过去 30 天内保持该功能运行大约需要 10 美元.这是非常可接受的,因为该函数有很多消息要消耗.将输出写入 blob 存储大约需要 20 美元.也可以接受.我不明白的是,Function 的底层存储帐户的费用在同一时期约为 70 美元.消耗主要针对文件写入操作单元文件协议操作单元.存储帐户创建为本地冗余通用 v1.

谁能解释这里发生了什么?查看存储帐户时,有一些 blob.我相信问题出在表存储上.检查存储帐户时,有如下表格:

<代码>$MetricsCapacityBlob$MetricsHourPrimaryTransactionBlobAzureWebJobsHostLogs201804

我已通过删除 AzureWebJobsDashboard 应用设置禁用登录我的功能.这样做之后,AzureWebJobsHostLogs* 表似乎不再接收新行.但 $Metrics* 表仍会收到新数据.不过,我不知道对这些表的写入是否会导致我在门户的成本管理视图中看到的所有文件写入活动.

这里发生了什么?真的需要从无服务器代码维护这些表吗?表访问的价格是函数本身价格的 7 倍听起来正常吗?

解决方案

您应该在 Azure 门户中为该存储帐户转到 Metrics 并检查文件存储事务的消耗模式.如果它一直很高,则说明您的应用程序存在问题(例如,要归档的日志记录过多).

就我而言,这似乎是 Azure Functions 中的一个错误,我提交了一个错误

I'm running a single Azure Function on the consumption plan. I've picked the consumption plan for the serverless feature as well as to minimize cost. The function consumes messages from a service bus topic and writes some output to blob storage.

Keeping the function running for the last 30 days is around $10. That's very acceptable, since the function has a lot of messages to consume. Writing the output to blob storage is around $20. Also acceptable. What I don't understand is, that the charge for the Function's underlying storage account is around $70 for the same period. The consumption is primarily hitting File Write Operation Units and File Protocol Operation Units. The storage account is created as locally redundant general purpose v1.

Anyone able to explain what's going on here? When looking at the storage account, there's a few blobs. I believe the problem is with tables storage. When inspecting the storage account, there are tables looking like this:

$MetricsCapacityBlob $MetricsHourPrimaryTransactionBlob AzureWebJobsHostLogs201804

I've disabled logging in my function, by removing the AzureWebJobsDashboard app setting. After doing so, the AzureWebJobsHostLogs* tables no longer seems to receive new rows. But the $Metrics* tables still receive new data. I have no clue if writes to these tables are causing all of the file write activity I see in the Costs Management view in the Portal, though.

What's going on here? Is maintaining these tables from serverless code really required and does it sound normal that the price for table access is x7 the price of the function itself?

解决方案

You should go to Metrics in Azure Portal for this storage account and check the patterns of how the File storage transactions are consumed. If it's consistently high, it's something with your application (e.g. too much logging to file).

In my case, it appears to be a bug in Azure Functions, and I filed a bug here.

The function starts consuming tens of thousands of read and write transactions after any code change, however minor. So basically each code change or deployment costs me perhaps around $0.20, and it could be more in your case.

This is easy to see in the Metrics diagram because it looks like a huge spike in transactions.

So the solution is: don't write logs to the filesystem and don't deploy often.

这篇关于Azure Functions 中存储帐户的昂贵使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆