Cloudflare Workers - How long does an isolate last for?

If you're using Cloudflare Workers or have been reading through the documentation to see if they're right for you, you've probably seen a lot about 'isolates' and 'eviction' - but what does that actually mean?


Cloudflare Workers leverages the V8 JavaScript engine, used primarily in Chromium. The Design of V8 bindings will explain the specifics of isolates and contexts but the general idea is that you have an isolate and a context - with your global scope for a given Worker script being that context.


Simply put, this is when your isolate has to be shutdown which can be for a variety of reasons. If there's scheduled maintenance, a runtime update or your Worker is using up too many resources, it can trigger eviction.

In the event of scheduled maintenace or runtime updates, your Worker has a grace period of 30 seconds until it'll be evicted.

With resource usage, it varies - going over the memory limit a little bit will trigger a soft eviction where inflight requests are allowed to finish but a lot of over-usage will trigger a hard eviction and inflight requests will receive a 1102 Resources Exceeded page.

What if you're not hitting either of these scenarios and your Worker has served a few requests & has no more work to do? The Worker will be eventually evicted...

... but how long exactly?


In my testing, at low traffic times (early morning in the United Kingdom), I could hit the same Worker instance even after 48 minutes of no requests.

It's worth noting that each metal (server) will have it's own isolate for your Worker, so you may hit different metals and colos within the same point of presence which will result in different Worker instances.

metal: 567f26
instantiated: true
lastRequestDelta: N/A

metal: 567f23
instantiated: true
lastRequestDelta: N/A

metal: 567f12
instantiated: false
id: 30238a5b-a761-482f-9f08-ae9fd5c7a56a
lastRequestDelta: 2921897

metal: 63f108
instantiated: true
lastRequestDelta: N/A

metal: 63f110
instantiated: false
lastRequestDelta: 606913

metal: 341f6
instantiated: true
lastRequestDelta: N/A

metal: 341f44
instantiated: false
lastRequestDelta: 2084215

With 7 cURL requests, we've hit 7 different metals - and one of them had one of our isolates which last had a request more than 48 minutes ago!

Update (08/05/2023): Some isolates are still up with 22 hours since their last request.

There is no hard limit for duration.

Looks like the documentation wasn't lying.