Firebase Storage very slow compared to Firebase Hosting

后端 未结 2 2038
囚心锁ツ
囚心锁ツ 2020-12-16 13:27

Anyone know why firebase storage would be so ridiculously slow compared to firebase hosting?

Results

  • Time to download image of fireba
相关标签:
2条回答
  • 2020-12-16 13:53

    Hosting = Storage + CDN, so really what you're seeing is you hitting a CDN near you, rather than going directly to the GCS or S3 bucket. Same is true with Cloudinary/Imgix. This is why performance is so much better for Hosting than Storage.

    Addressing the issue of TTFB being so different between AWS and GCP: unfortunately this is a known issue of GCS vs S3 (see this great blog post w/ in depth perf analysis). I know this team is working to address this problem, but going the "stick a CDN in front of it" route will provide a faster solution (provided you don't need to restrict access, or your CDN can authorize requests).

    Note: GCP has announced a Sydney region (announcement blog post) to be launched in 2017, which might help you.

    0 讨论(0)
  • 2020-12-16 14:06

    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.

    0 讨论(0)
提交回复
热议问题