Next.js Discord

Discord Forum

Do server actions experience cold starts?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
When deployed to Vercel, does each server action experience a cold start?

5 Replies

@Transvaal lion When deployed to Vercel, does each server action experience a cold start?
If they run on nodejs, yes. Edge server actions also have cold start although it is a lot faster (negligible cold start)
To configure the runtime of the server action, set the runtime of the page on which the server action is run
Transvaal lionOP
Thank you @joulev, I'm in a bit of a limbo as there is a tradeoff - I want the server action to run with the Edge runtime to achieve the lower cold start but am I right in assuming that opts the whole page out of static rendering?
Technically, you can configure the runtime to edge and use unstable_cache to manually cache your page queries, making the performance almost as good as a static page