Menu

1 / 2

How long a serverless function stays warm on DigitalOcean

DEV Community: cloud·Remdore·about 15 hours ago
#q9FXEVJN
#devtocloud#devto#dev#function#cold
Reading 0:00
15s threshold

Every serverless platform has cold starts, and every write-up about them gives you a number for how long a function "stays warm". I wanted that number for DigitalOcean Functions, so I measured it. There isn't one number. What decided whether my function was still warm had less to do with how long it had been idle and more to do with how long it had been alive before that.

The setup

Four functions, all web functions in the fra1 region, all with 512 MB of memory:

pysmall : Python 3.12, no dependencies

nodesmall : Node 22, no dependencies

nodeheavy : Node 22 with two AWS SDK v3 clients and lodash

pyheavy : Python 3.12 with numpy

Three copies of each, 12 functions in total, so I could run several idle gaps in parallel without one copy's calls warming another.

Each function creates a random ID when its code loads and counts its calls. A call that returns a call count of 1 ran in a brand new container. So I didn't have to guess cold from warm by latency.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.