Firebase存储工件很大,并且还在不断增加 [英] Firebase storage artifacts is huge and keeps increasing

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

问题描述

我刚刚注意到,我的应用的存储空间在过去几周内几乎达到了5GB的免费使用限制.在更详细地检查它之后,看起来这是由伪像"引起的.桶.

我看到了

我还注意到人工制品"带宽突增非常出乎意料,我认为这也会带来成本影响,我也很感谢任何可能的方法来最大程度地减少此类突增(22.5GB中约22GB来自工件"存储桶):

解决方案

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

  1. 转到Google云控制台,选择您的项目->存储->浏览器

    现在存储安全了!

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

    希望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天全站免登陆