cloudpatterns.appClassroomKatasWhiteboardBlog
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-on

Members lesson

Membership isn’t open yet. The free lessons are open — 16 of them.

  1. Link previewsUsers
  2. Album sync callsUsers
  3. Preview server (medium)Web API
  4. Album sync server (medium)Web API
From step 1 — Both servers bill about $34 a month every hour of the day.

What you'll be able to do

  1. 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.
  2. 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.
  3. 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