Cost LineLesson
Serverless vs always-on
Pixel's link previews sit on a server that waits all night. Move them to a function — and find the traffic where paying per call stops being cheaper.
14 minMediumStation: Serverless vs always-onMembers lesson
Membership isn’t open yet. The free lessons are open — 16 of them.
- Link previewsUsers
- Album sync callsUsers
- Preview server (medium)Web API
- Album sync server (medium)Web API
What you'll be able to do
- 1Predict the request rate at which a function's monthly bill crosses an always-on server's, from the price per call, the duration, the memory and the server's hourly rate.
- 2Explain why a function slows down after a quiet spell, fails when too many calls arrive at once, and costs more when a call hangs until its timeout.
- 3Choose a function, an always-on server or a mix for a workload from its traffic shape — idle stretches, bursts or a steady high rate — and its latency needs.
Inside the lesson
- steps
- 10
- questions
- 9
- simulations
- 4
You guess first, then run the system and see if you were right.
Step 1 · The setup
Even at 4 a.m. Pixel pays for servers. Two of them here, each a medium at $0.046 an hour — about $34 a month apiece:
- Link previews — the card a shared photo link unfolds into. Nobody shares links at night; by day a few a second, and an evening burst of 20 a second.
- The album sync API — phones sync albums with it at a steady 60 calls a second, day and night.
Steps 2–10 are for members