Serverless
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Serverless architecture: the 60-second story

    Serverless architecture

    Results portal: idle most of the year, then 30,000 requests a second.

    Servers sized for that peak sit idle, still billed. Serverless scales to zero and bills per request: a cab, not a car.

    Serverless = FaaS + BaaS

    An event invokes a stateless function; everything it must remember lives in managed services. No servers to size or patch, and idle costs nothing.

    Serverless means no servers?

    Bad: “There are no servers”

    There are. They just stop being your problem.

    Good: An operating model

    Give up control of machine, runtime and scaling; get no idle cost, no capacity planning.

    Same 100 ms handler. Why did this request take 800 ms?

    No idle environment, so a new one runs Init first: runtime, imports, SDK clients, a DB connection. Typically under 1% of calls pay it.

    30,000 requests/s × 0.1 s = 3,000 environments at 10:00. Quota raised. Serverless scales automatically, right?

    The catch

    Not instantly. Lambda adds 1,000 environments per 10 s: ≈ 440,000 requests get 429s while it catches up.

    1,000 environments, one Postgres. Who gets a connection?

    Each opens its own, against a typical max_connections of 100: 900 refused. A pooling proxy serves them from 50 real connections.

    27/s

    break-even against two always-on containers

    A 512 MB, 100 ms function costs ≈ $1.03 per million requests. Two containers cost $72 a month, busy or idle. Above that, steady traffic favours them.

    When not to use it

    1. Steady high load: a premium on every request
    2. Jobs past the 15-minute limit, like video encodes
    3. Heavy in-memory state: big caches, game rooms
    4. Chatty, data-heavy pipelines, like Prime Video’s monitor

    Remember

    Serverless is functions plus managed services: no idle cost, pay per request. Plan concurrency, pool connections, move steady load to containers.