Workers requests per second

I found this in limits section of worker docs

Bundled (Paid) Workers scripts automatically scale onto thousands of Cloudflare edge servers around the world; there is no general limit to the number of requests per second Workers can handle.

So does that mean that the workers can handle even if it is hit with millions of requests and it still won’t go over memory limit?

If that true then is it also applicable to workers unbound since the docs only says that about bundled requests and not about unbound workers

1 Like

Good question, other people brought it up. The 128MB is “per thread” (per incoming HTTP req).

Someone from CF staff wrote a CF worker will not be killed mid-request if it goes above “128 MB”, but after the response is returned, the worker process exits/killed, and a new worker will be spawned from source code. If you only keep function level variables (var/let), and never file level scope variables ( = = , or ;\n myString = 'the string';, Im not sure what this obj is inside a CFW) outside the onfetch event handler addEventListener("fetch",function(event){foo();})), your memory is deallocated/garbage collected between requests. Im sure there is a 10XX error for worker out of RAM, but the instant-kill limit is higher than 128 MB RAM. Since you have no way to measure V8’s memory limits locally, the RAM limits aren’t very mathematical.

In terms of requests per second, if 1 worker process is busy burning CPU responding to an old/already established HTTP req, CF instantly launches another worker process for the next incoming HTTP req with no limits for simultaneous processes per zone/domain. Worst cast scenario is worker requests all have a 100-120 ms TTFB cold-start instead of 35-60 ms TTFB warm response since none of the workers ever handle a 2nd HTTP req under extreme eyeball load, or a memory leak at file/global scope.

1 Like

I read in the workers limit section that the worker memory is not per requests but for a worker instance and only one of them run in an edge server.

Only one Workers instance runs on each of the many global Cloudflare edge servers. Each Workers instance can consume up to 128MB of memory.