Firebase 存储工件巨大且不断增加 [英] Firebase storage artifacts is huge and keeps increasing

查看:22
本文介绍了Firebase 存储工件巨大且不断增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注意到,在过去几周内,我的应用的存储空间几乎达到了 5GB 的免费使用限制.仔细检查后,似乎是由神器"造成的.桶.

我看到

我还注意到神器"带宽出乎意料地飙升,我想这也有成本影响,我很感激任何关于尽可能减少这种峰值的方法的投入(22.5GB 中的大约 22GB 来自工件"桶):

解决方案

想出了一个解决方案 - 似乎有一种方法可以在谷歌云控制台中为那些杂乱存储的图像设置自动删除规则.

  1. 进入谷歌云控制台,选择你的项目->存储->浏览器

    现在存储是安全的!

    注意:如果您以后遇到任何部署问题,例如连续部署几天并且在部署时出现错误,只需删除整个容器"即可.在应该解决它的工件中手动文件夹,然后再次重新部署.(确保不要删除工件存储桶本身!)

    希望 Firebase 团队能够改进这一点 - 当前的行为看起来令人困惑,因为它很容易导致意外账单,除非您采取额外措施来防止这种情况发生.但你永远不会知道它会发生,直到它发生.

    I've just noticed that my app's storage was bumped almost to it's 5GB limits of free usage within the last few weeks. After checking it in more details, it appeared that this was caused by the "artifacts" bucket.

    I saw this SO question which says that the "artifacts" bucket is related to Node 10 environment.

    I indeed moved to Node 10 a month ago, but after figuring out that the logs are no longer structured in the firestore functions console, I've reverted back to Node 8 a few days later and only using Node 8 since then.

    However I can see that the "artifacts" storage keeps increasing by about ~800Mb every week which worries me to say the least (please check the screenshots below)

    I assume this is related to firestore functions deploys (or not?), but is this really expected? Can I cleanup this artifacts safely?

    It looks very strange to me that it increased that dramatically within just a few weeks while previously I was using functions for a few years and never had any issues like that.

    Appreciate any suggestions on how to safely handle storage size in this case and to keep its consumption at minimum.

    I'm also using pubsub.schedule function in case it matters here.

    I've also noticed that "artifact's" bandwidth spiked quite unexpectedly which I guess also has cost implications and I'd appreciate any input on possible approaches to minimize such spikes as well (about 22GB out of 22.5GB came from the "artifacts" bucket):

    解决方案

    Figured out a solution - it appeared there is a way to setup an auto deletion rule in google cloud console for those images that clutter the storage.

    1. go to the google cloud console, select your project -> storage -> browser https://console.cloud.google.com/storage/browser

    2. Select the "artifacts" bucket

    3. Under the "lifecycle" tab add a rule to auto delete old images (in my case I put "delete after 1 day since update" which works fine for me)

    Storage is safe now!

    NOTE: if you face any deployment issues later, like if you deploy several days in a row and if it gives you an error on deploy, just delete the whole "container" folder manually in the artifacts which should solve it and then redeploy again. (make sure not to delete the artifacts bucket itself!)

    Hope the firebase team will improve that - the current behavior looks confusing as it easily leads to an unexpected bill unless you take extra steps to prevent that. But you'll never know that it will happen until it does.

    这篇关于Firebase 存储工件巨大且不断增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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