# What is function as a service (FaaS)? Function as a service (FaaS) runs a single handler each time an event arrives, such as an HTTP request, and bills only for that run. The platform starts, scales and stops it. **On Runtime, a [Function](/docs/functions) is a handler on a Linux machine of its own. It serves the Web-standard `export default { fetch }` in `/app/index.ts`, pauses after 60 seconds with nothing happening, and the next request resumes it with its memory kept.** CPU is billed at $0.03 per busy vCPU-hour while it answers, and nothing for CPU while it is paused. ## FaaS and serverless FaaS is the compute part of [serverless computing](/glossary/serverless-computing). Serverless is the wider idea: no servers for you to manage, paid by use. It also covers managed databases, queues and object storage. FaaS is the piece that runs your own code. ## How a function runs 1. **An event arrives.** An HTTP request, a message on a queue, a file upload, a schedule. 2. **The platform finds a ready instance, or makes one.** Making one is a [cold start](/glossary/cold-start): the runtime boots and your module loads before the handler can answer. 3. **The handler runs.** It reads the event and returns a result. Code at the top of the module ran once, at load, and is shared by every call to that instance. 4. **The instance waits, then goes away.** Many platforms keep an instance warm for a while, then stop it. Its memory is lost, so the next cold start loads everything again. ## What you gain and what you give up | Trait | What it means for you | | --- | --- | | No idle servers | Nothing to patch, and no bill for a process that waits | | Scale by request | Each request may get its own instance, so a burst is absorbed | | A handler, not an app | One entry point per event, so each piece deploys on its own | | Time limits | A run is usually capped in minutes, so long jobs go elsewhere | | No state between calls | A fresh instance starts empty, so state lives in a database | | Cold starts | The first request after a quiet spell waits for the start | | One shape of code | A language and handler format the platform supports | ## How a Runtime Function differs A Runtime Function pauses rather than stopping. A pause keeps the machine's memory, its files and its loaded module, and the next request resumes it there instead of starting from nothing ([what a pause keeps](/glossary/memory-snapshot)). It is a whole Linux machine, so the handler can call a system binary or read files it wrote on an earlier request. The handler format is the one Cloudflare Workers, Bun and Deno take, so the same file runs on each. ```ts no-run // /app/index.ts: answers every request with its path. export default { fetch(request: Request) { return Response.json({ path: new URL(request.url).pathname }); }, }; ``` [How to deploy an HTTP function](/how-to/deploy-an-http-function) creates a Function, uploads this file and calls it, step by step. ## When FaaS fits FaaS fits work that arrives in events and finishes quickly: webhooks, API endpoints with uneven traffic, image resizing, glue between services. A web app with steady traffic, or one that keeps connections open, fits a [platform as a service](/glossary/platform-as-a-service) better, where one process stays running. ## Related - [How to deploy an HTTP function](/how-to/deploy-an-http-function) - [What is serverless computing?](/glossary/serverless-computing) - [What is a platform as a service (PaaS)?](/glossary/platform-as-a-service) - [What is a webhook?](/glossary/webhook) ## Sources - [MDN, Request](https://developer.mozilla.org/en-US/docs/Web/API/Request), checked 17 November 2026 - [Bun, HTTP server](https://bun.com/docs/api/http), checked 17 November 2026 Facts on this page were checked on 17 November 2026.