How to eliminate cold boots for serving images from google cloud storage

I’ve already set up a google cloud storage bucket with images in it that I can access through the domain I’ve set up through Cloudflare. However I’m noticing slow load times when accessing the images for the first time; I believe this is due to cold starts. I read that cold starts can be eliminated with Cloudflare workers, but I couldn’t find how to set that up for a cloud storage bucket. Can someone help?

Maybe you might have to setup a Page Rule for that CNAME hostname (pointed to the GCS bucket) so it would keep them longer in the Cloudflare cache (Edge Cache TTL)?

Are you using multi-regional GCS or?

May I ask if they are large images (by resolution and/or by size)?

1 Like

It’s not a cache issue; after I access any image one time I can access an image that I have never accessed before very quickly. The problem is if I try to access any image for the first time in a few hours, it will take longer than 5 seconds to do so.

Yes, the bucket is multi region.

The images are small, mostly under 1mb each.

I don’t see how a Cloudflare Worker can fix Google’s cold boot delay. Cloudflare works hard to make their Workers launch quickly, but there’s nothing they can do if the resource they’re pulling from is slow.

Probably the best you can do from this end is prefetch some resources.

1 Like

Those can be problematic. We rely on AWS for real-time applications, and we faced up to 6000% slowness during cold starts :cold_sweat:

Workers can help if you set up a cron trigger to consume that resource often enough to keep it in a warm state constantly.

https://developers.cloudflare.com/workers/platform/cron-triggers#adding-cron-triggers

I doubt you will find a specific application for what you need, but it should be trivial to develop.

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.