151. Design Serverless Functions like AWS Lambda
Run strangers' code on shared hosts in Firecracker microVMs, scale each function from zero in seconds, load 10 GB images lazily and bill by the millisecond.
Start with a template. Work through each step. Ask Coach when you need a second opinion.
Company tags are community-reported. Counts on cards show how many people reported that design.
Run strangers' code on shared hosts in Firecracker microVMs, scale each function from zero in seconds, load 10 GB images lazily and bill by the millisecond.
Push fan-out to queues, functions, webhooks, inboxes and phones: stored in three AZs before the ack, retries per protocol, DLQs, filters, FIFO order.
A consistent key-value store like etcd: Raft across three AZs, MVCC revisions in bbolt, watches, leases and compare-and-swap, run as a fleet behind Kubernetes.
Virtual machines launched in seconds onto shared servers: zonal control planes, bin packing, Nitro offload cards, a mapped virtual network and Spot.
SQL tables split into Paxos groups across regions, ordered by TrueTime and commit wait, and read without locks at any replica.
An LSM-tree key-value engine inside its caller: a WAL and a memtable, levelled compaction, filters and caches, then one engine per node under Raft.
Shards of fixed capacity, partition keys hashed to ranges, three copies in three AZs, live resharding, polling and push readers with KCL leases.
Layer-7 proxies and layer-4 flow hashing behind DNS, health checks and draining, a control plane outside the request path, cells and zonal shift.
DNS steering to 750 POPs, regional caches and Origin Shield with request collapsing, purges in seconds, edge functions, DDoS at the edge.
Authoritative DNS at cloud scale: anycast stripes, shuffle-sharded name servers, routing policies, health-checked failover, a control plane that can fail.
A sparse, sorted, versioned map cut into tablets: stateless tablet servers over S3, a replicated log, a lock service and a master.
Isolated tenant networks on one shared fabric: an overlay keyed by VPC id, rules on every host's Nitro card, a mapping service per AZ, gateways as fleets.
A state-machine orchestrator: steps that happen once, waits of up to a year, retries with jitter, .sync jobs and task tokens, Distributed Map over 100 M items: one-hour boards for junior, senior and staff, with the theory.
Delivering LLM tokens from model servers to millions of apps: SSE through CloudFront and an ALB, resumable streams and a stop that frees the GPU. One-hour boards for junior, senior and staff, with the theory behind them.
Llama 3.1 70B with prefill and decode on separate GPUs and the KV cache handed over NVLink or EFA, two pools sized from the token mix.
A 3 B LLM on phones and laptops: bandwidth math, 4- and 2-bit weights, LoRA per feature, NPU runtimes, cohort rollouts, a private server.
Which model answers each request: rules, a score per tier, thresholds fitted on judged labels, cascades where a check exists, and the loop that keeps quality measured: one-hour boards for junior, senior and staff, with the theory.
Text in, unit vectors out for every product at 100,000 requests a second on AWS GPUs, batched by tokens and never mixing model versions.
Live captions from a streaming Conformer-transducer: chunked attention with a per-stream cache, partials and finals, biasing, a post-call pass and a training loop.
A cheap drafter guesses several tokens and a self-hosted 70B checks them in one pass, with rejection sampling keeping its output distribution exact.
A phone and browser agent that talks, calls tools and hands off: streaming ASR, LLM and TTS, turn detection, barge-in, a sub-second budget, telephony, simulated callers: one-hour boards for junior, senior and staff, with the theory.
Agents that call tools to finish multi-step tasks: the ReAct loop as a durable workflow, JSON-schema tool calls, microVM sandboxes, per-user OAuth, approvals, injection defences and pass^k evals: one-hour boards at three levels.
A coding assistant like Copilot: fill-in-the-middle completion in a 300 ms budget, prompts from open tabs and the repo, acceptance and persistence metrics, agents that edit and test: one-hour boards per level, with theory.
Search and cited answers across drives, wikis, tickets, chat and mail, trimmed to what each employee may open: ACL sync, identity mapping, hybrid retrieval, revocation deadlines and tenant keys, on junior, senior and staff boards.
A copilot that hears a live call and suggests answers within a second: two-channel capture, streaming recognition, a question detector, retrieval, a small LLM, summaries after the call, consent and cost at scale.
Guard LLM apps both ways: classifiers on prompts and streamed chunks, PII masking, injection and grounding checks, per-tenant policies, a red-team loop.
Prompt templates run side by side on several models over server-sent events, immutable versions with movable labels, an SDK cache that never blocks production, queued evaluations and CI gates: one-hour boards at three levels.
A weekly playlist of 30 never-played songs, plus home shelves, for 300 M listeners: implicit ALS, playlist and audio embeddings, a multi-task ranker, fair assembly and a bandit: three one-hour boards, with the theory behind them.
A vertical feed that picks each next video from what the viewer did seconds ago: labels at the swipe, multi-source retrieval, a multi-task ranker, online training and a fair start for new creators, as three one-hour boards.
Show what goes with a product, not what replaces it: directional co-purchase lift, item2vec, a cart-aware LambdaMART, feedback loops and cold start.