Cloud Function 会影响 Firebase 存储带宽的使用吗? [英] will Cloud Function affect Firebase Storage bandwidth usage?

查看:32
本文介绍了Cloud Function 会影响 Firebase 存储带宽的使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚为什么 firebase 存储使用量远远超出我的预期

I am trying to figure out why firebase storage usage is far above my expectation

我的 Firebase 存储中只有几个照片文件,大约 75 张照片,每张照片 100kb.但是我存储的字节数和对象计数远远超出了我的预期,如上图所示.在这种情况下,也许我可以从 此处

I only have few photo files in my Firebase storage, just around 75 photos, 100kb for each photo. but my bytes stored and object counts is way above my expectation as you can see in the image above. in this case, maybe I find the answer from the documentation in here

当您将函数的源代码部署到 Cloud Functions 时,源存储在 Cloud Storage 存储分区中.云构建然后自动将您的代码构建到容器映像中并将其推送镜像到 Container Registry.Cloud Functions 访问此图像时它需要运行容器来执行您的功能.

When you deploy your function's source code to Cloud Functions, that source is stored in a Cloud Storage bucket. Cloud Build then automatically builds your code into a container image and pushes that image to Container Registry. Cloud Functions accesses this image when it needs to run the container to execute your function.

构建图像的过程是完全自动的,需要没有来自您的直接输入

The process of building the image is entirely automatic and requires no direct input from you

可能是因为我创建了很多云函数.这就是为什么我的 Firebase 存储中存储的字节数和对象计数很大

it is probably because I create a lot of cloud function. thats why the bytes stored and object count in my Firebase Storage is big

现在我需要知道为什么存储带宽在一个月内高达 20.2 GB.我仍在开发我的应用程序,用户就是我.我不认为我会在一个月内达到 20.2 GB,因为在我的 Android 应用中,我在显示图像时使用缓存.

now I need to know why storage bandwidth is up to 20.2 GB in a month. I am still developing my app, the user is just me. I don't think I will hit 20.2 GB in a month, because in my Android app, I use cache when showing the image.

我很怀疑,我的存储带宽使用率过高的原因是云功能.8 月,我对我的云函数执行了很多 firebase deploy.Cloud Function 会影响 Firebase 存储带宽的使用吗?

I am suspicious, the reason why my storage bandwidth usage is too high is because of cloud function. in August, I perform a lot of firebase deploy to my cloud function. will Cloud Function affect Firebase Storage bandwidth usage ?

我在印度尼西亚,我的 Firebase Storage 和 Firestore 位于 asia-southeast2,但我的 Cloud Function 位于 asia-east2.我的云功能对我的 firestore 和存储中的图像执行一些操作.但我仍然认为它不会达到每月 20.2 GB

I am in Indonesia, my Firebase Storage and Firestore are located in asia-southeast2, but my Cloud Function is located in asia-east2. my cloud function perform some operation to my firestore and images in storage. but still I don't think it will hit 20.2 GB per month

如上图所示,带宽使用分为 3 个不同的部分

as you can see from the image above, the bandwidth usage is separated into 3 different parts

  1. asia.artifacts.projectID.appspot.com
  2. gcf-sources-5900904-asia-east2
  3. projectID.appspot.com

asia.artifacts.projectID.appspot.com 似乎比其他的要好得多,它高达 4.3 GB

the asia.artifacts.projectID.appspot.com seems way above the other, it is up to 4.3 GB

这就是我的问题的一些信息.所以我需要知道,云功能部署/操作会影响我的 Firebase 存储带宽使用吗?

thats some information of my problem. so I need to know, will cloud function deployment/operation affect my Firebase Storage Bandwidth usage ?

我需要了解为什么会发生这种情况,因为我担心如果有很多用户使用我的应用程序会产生意想不到的成本.

I need to understand why this is happened, because I am worried that I will have unexpected cost if a lot of users use my app.

推荐答案

我也对带宽使用感到惊讶.

I was surprised by the bandwidth usage too.

首先,Firebase 更改了一些政策

First, Firebase Changed some policy

2020 年 8 月 17 日之后,每次部署操作都会产生用于函数容器的存储空间的小规模费用.例如,如果您的函数通过 Container Registry 消耗 ?>1GB 的存储空间,则您每月需要支付 0.026 USD.如果您的 >开发过程依赖于部署测试功能,您可以在开发过程中使用 Firebase 本地模拟器套件进一步降低 >成本.

After August 17, 2020, each deployment operation will incur small-scale charges for the >storage space used for the function's container. For example, if your functions consume ?>1GB of storage via Container Registry, you'll be billed $0.026 per month. If your >development process depends on deploying functions for testing, you can further minimize >costs by using the Firebase Local Emulator Suite during development.

所以最合理的解释是在npm install过程中构建云函数会产生下载node_modules的带宽占用,同时也占用存储空间.

So the most reasonable explanation is cloud function build during npm install generates bandwidth usage of downloading node_modules and also takes up storage.

我建议在开发过程中尽量使用本地模拟器,但是很多情况下生产测试是不可避免的,太伤心了.

I would suggest use local emulator during development as much as possible, but many cases production test is inevitable, so sad.

这篇关于Cloud Function 会影响 Firebase 存储带宽的使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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