How can I find out if a request hit a new worker instance or one that was already warm?

I know there is supposedly no cold start time but when I package my Rust worker I get a warning that workers >1MB have higher cold starts. I do occasionally see longer response times of ~2 seconds and I want to find out if that's because of a cold start or something else.
1 Reply
zegevlier
zegevlier9mo ago
I am not sure if this is possible in a rust/WASM worker, but you could add a variable to the global scope (eg. let isCold = true), then on each request, if that variable is still set to the default, set it to something else. If it's already set to something else, you know it's warm, else you know it's cold.
Want results from more Discord servers?
Add your server