与Firebase托管相比,Firebase存储非常缓慢 [英] Firebase Storage very slow compared to Firebase Hosting
问题描述
结果
- Firebase托管:
16ms
- 从firebase存储中下载相同图片的时间:
2.23s(2.22s是TTFB )
- 从firebase存储(亚太地区)下载相同图片的时间:
1.72s(1.70s是TTFB)$ (文件大小:22.7kb / jpeg / firebase storage已经阅读给大家)
这在测试中反复重复。有没有什么办法可以加快这个速度呢?还是说firebase的存储空间对于小文件(images / thumbs)来说是不可用的?
用于比较
- S3 North Cal - 大约
500ms
- Cloudinary - 大约
20ms
S3亚太地区 - 大约
30ms
额外信息:
- 我在澳大利亚。
- 完全相同的文件。总是在100kb以下的图像。
- 根据开发工具,速度总是在TTFB中。
- 主机URL:https://.firebaseapp。 com / images / thumb.jpg
- 存储网址: https: //firebasestorage.googleapis.com/v0/b/ .appspot.com / o / thumb.jpg?alt =媒体&令牌=
<我找到了解决方案。
如果您已经将文件上传到存储,请转到: https://console.cloud.google.com/storage/browser?project=your_project <选择所有有趣的文件,然后单击公开(或类似的东西 - 我不是英文原文)。 要获取所有新上传的文件公共默认情况下,您需要安装Google云SDK( https://cloud.google.com/sdk/docs/ ),并从您的命令行中为您的存储桶使用以下命令: 之后,我所有的当前和新的图片都可以在这里storage.googleapis.com/my_project.appspot.com/img/image_name.jpg Anyone know why firebase storage would be so ridiculously slow compared to firebase hosting? Results This is repeated over and over in tests. Is there any way to speed this up to a decent time, or is firebase storage unusable for small files (images/thumbs)? For Comparison Extra info:
gsutil defacl set public-read gs:// your_bucket
,下载时间肯定短。
16ms
2.23s (2.22s is TTFB)
1.72s (1.70s is TTFB)
500ms
30ms
20ms
I found the solution.
If you have your files already uploaded to storage go to: https://console.cloud.google.com/storage/browser?project=your_project > pick your bucket > select all interesting files and click Make public (or something similar - I'm not english native).
To have all new uploaded files public by default you need to install Google cloud SDK (https://cloud.google.com/sdk/docs/) and from your command line use the following command for your bucket:
gsutil defacl set public-read gs://your_bucket
After that all my current and new images are available here storage.googleapis.com/my_project.appspot.com/img/image_name.jpg and downloading time is definitely shorter.
这篇关于与Firebase托管相比,Firebase存储非常缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!