Cloudflare Workers for heavy traffick

Hi Folks,
I want to user R2 for retrieving images which will be of size 2mb (max).
but my app will be having heavy traffic for specific region.
Now i heard that for one region there will be only one instance of worker and I read somewhere that Cloudflare automatically create other instances of worker when it experienced high traffic and when it create other instances they will be having 128 mb of their own. Now I have 2 questions.

  1. for a region Cloudflare automatically creates instance? if yes they will they charge for their own memory, because limit is 128 mb and now we have more than one instance?

  2. can we use more than one worker and do load balancing in worker?

I fear that there is also a possibility that Cloudflare will not create any other instance, is that true? then what is the workaround? remember I have app specifically retrieves images for a specific region.

thanks in advanced.

This is not true. Unless your Worker is getting extreme amounts of traffic, Cloudflare usually will only run a single instance of your Worker per server.

But Cloudflare has thousands of servers worldwide, so even if a lot of traffic is coming from a single region, that will be spread across hundreds of servers.

Each instance of a Worker can use up to 128 MB of memory. If you are just retrieving a file from R2 and returning it to the client, the Worker does not have to buffer the image in memory. This means a single Worker can serve hundreds of client simultaneously without running out of memory.

2 Likes

Hi @albert thanks for clarification, from your answer it is clear that i don’t need to be worried about scaling the worker process.
so hundreads of server may execute a worker in case of very very high traffic memory limitation will not be imposed. i got it.

thanks.

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