Based on the discussions here I made my Google Cloud Storage image public but its still taking a lot of time for TTFB? Any idea why? How can I reduce the TTFB while calling Google Cloud Storage?. My URL and snapshot of what i see on developer tools is given below Public image URL
-
Based on what discussion? It's unclear what are you trying to achieve? What are you doing and what are you trying to achieve? If you want to reduce the TTFB, you need to do the server-side work faster. For this you have to show with us how your server work. – Chris32 Dec 27 '19 at 11:31
-
It was based on https://stackoverflow.com/questions/43851742/firebase-storage-very-slow-compared-to-firebase-hosting as per this link if i make it public google should start caching the image. In my case there is no reduction in TTFB? even when i fire the URL standalone on a browser. – buildmyfuture Dec 27 '19 at 12:43
-
@Chris32 you mentioned the server side work needs to be done faster, but if u take the URL which is a direct URL to an image in an bucket and check the developer tools you will still see the TTFB? Is there anything wrong with the configuration on google storage? – buildmyfuture Dec 27 '19 at 12:46
-
1Setup Cloud CDN with Cloud storage to reduce TTFB – Travis Webb Dec 30 '19 at 06:42
2 Answers
Ok, now I understand your question. Your concern is how to reduce the TTBF time of requesting an image from Google Cloud Storage. There is not a magic way to reduce the TTFB to 0. This is near to impossible. Time to First Byte is how long the browser has to wait before start receiving data. For the specific case of Google Cloud Storage is (in a general way) the time between you requesting an image, this message being delivered to the Google server where your image is stored, this server searching the image and delivering the image to you.
This will depend on 2 main factors:
- The speed of the message being transport to/from the server. This will depend on the speed of your connection and the distance between the server and you. It is not the same if you are fetching an image form USA or from India, this will give you 2 very different TTFB.
You can see this example where I get the same image from 2 different buckets with public policy. For reference, I'm in Europe.
Here is my result calling the image from a bucket in Europe:
And here is my result calling the image from India:
As you can see that my download time doesn't increase that much while my TTFB is doubled.
- The second factor to see if you want to reduce your TTFB is the speed of the request being processed by your server. In this case, you don't have much influence on this since you are requesting this directly from Google Cloud Storage and you can't modify the code. The only way to influence this is by removing load to the request. Making the image public helps with this because now the server doesn’t have to look for certs or permissions, it will just send you back the image.
So, in conclusion, there is not much that you can do in here to reduce the TTFB more than select a server closer to your user location and improve your internet speed.
I found this article really useful and could help you to understand better the TTFB and how to understand it measurement.

- 4,716
- 2
- 18
- 30
Thanks I have moved my bucket to a nearby location to my users. That has reduced the time

- 31
- 7