与Firebase托管相比,Firebase存储非常缓慢 [英] Firebase Storage very slow compared to Firebase Hosting

查看:298
本文介绍了与Firebase托管相比,Firebase存储非常缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道为什么Firebase存储与Firebase托管相比将会非常慢

结果


  • Firebase托管: 16ms

  • 从firebase存储中下载相同图片的时间: 2.23s(2.22s是TTFB )

  • 从firebase存储(亚太地区)下载相同图片的时间: 1.72s(1.70s是TTFB)


这在测试中反复重复。有没有什么办法可以加快这个速度呢?还是说firebase的存储空间对于小文件(images / thumbs)来说是不可用的?

用于比较


  • S3 North Cal - 大约 500ms

  • S3亚太地区 - 大约 30ms
  • Cloudinary - 大约 20ms



额外信息


  • 我在澳大利亚。

  • 完全相同的文件。总是在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/ ),并从您的命令行中为您的存储桶使用以下命令:



gsutil defacl set public-read gs:// your_bucket



之后,我所有的当前和新的图片都可以在这里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

  • Time to download image of firebase hosting: 16ms
  • Time to download same image from firebase storage: 2.23s (2.22s is TTFB)
  • Time to download same image from firebase storage (Asia Pacific Region): 1.72s (1.70s is TTFB)
  • (File size: 22.7kb / jpeg / firebase storage has read open to everyone)

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

  • S3 North Cal - approximately 500ms
  • S3 Asia Pacific - Approximately 30ms
  • Cloudinary - Approximately 20ms

Extra info:

  • I am based in Australia.
  • Exact same files. Always images under 100kb.
  • The slow down is always in the TTFB according to dev tools.
  • Hosting URL: https://.firebaseapp.com/images/thumb.jpg
  • Storage URL: https://firebasestorage.googleapis.com/v0/b/.appspot.com/o/thumb.jpg?alt=media&token=

解决方案

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屋!

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