What is Serverless?

By

Published · Updated

Tagged: Web Platform

Learn what serverless means: you deploy a function to a cloud provider, get a URL to call, and pay only for the requests you serve as it scales automatically.

Serverless is a way to run programs without managing your own server.

You create a function, deploy it to a cloud provider, and you get a URL to call.

When you call that URL, the function runs.

Someone else manages the server, the scaling, the security. There’s no need to worry about kernel updates or moving to the next LTS release of your Linux distribution.

The name is a bit misleading. There are servers, of course. You just never see them.

What a function looks like

There’s no listen() and no port to choose. You export a function, and the provider calls it every time a request comes in.

This is a complete function for Cloudflare Workers:

export default {
  async fetch(request) {
    const url = new URL(request.url)
    const name = url.searchParams.get('name') ?? 'world'

    return Response.json({ message: `Hello ${name}` })
  },
}

It gets a Request and returns a Response, the same objects you use with fetch() in the browser.

This is the same thing on AWS Lambda, called through a function URL:

export const handler = async (event) => {
  const name = event.queryStringParameters?.name ?? 'world'

  return {
    statusCode: 200,
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ message: `Hello ${name}` }),
  }
}

Here the request arrives as a plain object called event. You return an object with the status code, the headers and the body, and Lambda turns it into the HTTP response.

The idea is the same, the shape of the code is not. Keep this in mind for the lock-in part below.

Why people like it

The pricing model is the big draw. Traditionally you rent a VPS (Virtual Private Server) and pay the monthly price regardless of your actual usage.

If someone shares your site in a popular place and traffic spikes, a small VPS might not be able to serve all the requests unless you upgrade to a bigger one.

With serverless, you pay for requests rather than for the server. If no one is using your service, you pay nothing, or close to nothing. If 100,000 people jump on your site all at once, the provider adds capacity for you, and you pay for what actually ran.

When done right, it’s also liberating for developers working on their own projects. You are not in charge of the machine, so you are not on call 24/7 for it, and you don’t have to be a sysadmin to run an API endpoint.

What it costs

Every provider has its own formula, but they all count the same 2 things: how many requests you got, and how much computing each one used.

Some numbers, as of November 2026:

A GB-second is one second of a function that has 1 GB of memory. A function with 128 MB of memory that runs for 8 seconds uses 1 GB-second.

A side project with little traffic can stay inside the free amounts.

Where is the catch?

When I first wrote this post in 2018, every provider had its own implementation and the tooling was rough. That part is solved now. What remains:

Pricing can also go the wrong way. If your traffic is steady and predictable, a reserved VPS or a small always-on container is often cheaper than per-request billing.

Limits to know

A function is not a small server. It has limits that a VPS does not have.

It can’t run forever

On AWS Lambda a function can run for 15 minutes at most.

Cloudflare Workers counts CPU time instead: 10 milliseconds per request on the free plan, 30 seconds by default on the paid plan, and you can raise that to 5 minutes. The time spent waiting for a fetch() call or a database query does not count.

A job that takes longer needs to be split in smaller steps, or moved somewhere else.

It forgets everything between requests

The provider starts and stops copies of your function as it likes.

A variable you set during one request might not be there for the next one. 2 requests that arrive at the same time can end up in 2 different copies. The same goes for files you write to disk.

Anything you want to keep goes in a database or in object storage.

Memory and request size are capped

A Worker has 128 MB of memory. On Lambda you choose, from 128 MB to 10,240 MB, and more memory costs more.

Lambda also limits the request and the response to 6 MB each, unless you stream the response. For big uploads, send the file straight to object storage and don’t pass it through the function.

Databases can run out of connections

A classic server opens a few connections to the database and reuses them.

With serverless, every copy of your function opens its own. During a traffic spike there can be hundreds of copies, and a database like PostgreSQL only accepts a limited number of connections.

The fix is a connection pooler that sits between the functions and the database. On Cloudflare that’s Hyperdrive.

Major players

The main cloud function platforms:

AWS Lambda is still the reference point. It natively supports Java, Go, PowerShell, Node.js, C#, Python and Ruby, plus any other language through its Runtime API. Their Lambda FAQ is worth a read.

Most web developers never touch those directly. They use a platform that hides the details, like Netlify Functions or Vercel Functions, where a function is just a file in your repository, or a deploy tool like the Serverless Framework.

Cloudflare Workers is a different model: V8 isolates running at the edge instead of Lambda-style containers. This blog runs on Cloudflare Pages, and its few backend endpoints (the newsletter form, the purchase webhook) are Pages Functions, which are Workers under the hood.

Serverless is not only functions

The word is also used for databases, storage and queues that work in the same way: there is no server to manage, and you pay for what you use.

Cloudflare D1 and Amazon DynamoDB are databases of this kind. Cloudflare R2 and Amazon S3 do the same for files.

A typical serverless app is a function plus a few of these services.

When serverless fits

Serverless fits APIs and webhooks with uneven traffic, and jobs that run now and then.

A VPS or a container is simpler when you need long-running processes or WebSocket connections that stay open, when traffic is steady enough that a small always-on box costs less, or when you want the OS and the disk under your control.

Want me to talk about your product? You can sponsor this site.

Related posts about platform: