All guides
Home Glossary Serverless
Term

Serverless

A cloud computing model where the cloud provider automatically manages the infrastructure, abstracting server management from the developer.

Serverless is a cloud computing model where the cloud provider automatically manages the underlying infrastructure, abstracting server provisioning, scaling, and maintenance away from the developer. Instead of managing virtual machines or long-running containers, engineering teams deploy discrete pieces of code—most commonly through Function-as-a-Service (FaaS)—alongside managed backend services. Billing follows a granular pay-as-you-go model, meaning you pay strictly for active execution time and resource consumption rather than idle server capacity.

How it works

Serverless platforms operate on an event-driven architecture. When an incoming event occurs—such as an HTTP request routed through an API gateway, a file upload to object storage, a message arriving in a queue, or a scheduled cron trigger—the provider dynamically allocates compute resources, initializes an isolated execution environment, runs the code, and releases the resources once execution completes.

Because instances spin down automatically after periods of inactivity, applications can scale to zero when traffic drops and scale out horizontally during sudden spikes. This architecture is well suited for several workloads:

  • Real-time file processing, such as generating image thumbnails upon upload;
  • Lightweight backend APIs and webhooks for web and mobile applications;
  • Asynchronous stream processing and IoT telemetry ingestion;
  • Scheduled background jobs, report generation, and routine database cleanup.

When a function runs after sitting idle, initializing a fresh runtime container causes a delay known as a cold start. Cold start latency varies widely depending on the chosen language runtime, package size, and network configuration, though platforms offer provisioned concurrency or pre-warmed instances to keep latency predictable for user-facing endpoints.

Example

A typical serverless implementation pairs a stateless function handler with a declarative configuration file that binds an HTTP route to the code. Below is a minimal Node.js handler that processes an incoming API request:

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}` }),
  };
};

The platform deploys this single file, wires it to a public endpoint, and automatically manages TLS termination, load balancing, and concurrent execution.

What matters when choosing a server or hosting

  • Traffic predictability: Workloads with sporadic, bursty, or low-volume traffic benefit most from scaling to zero, whereas steady, high-throughput workloads are often more economical on dedicated virtual machines or managed container clusters.
  • Execution limits: Serverless functions enforce strict caps on maximum execution duration, memory allocation, and payload size, making them unsuitable for long-running batch jobs or persistent WebSocket connections without specialized platform features.
  • State and database connections: Because function instances are ephemeral, applications cannot store state in local memory or disk and must use connection pooling or serverless-compatible data stores to avoid exhausting database connection limits during traffic surges.
  • Vendor lock-in: Tight integration with proprietary event triggers, identity systems, and managed queues can make migrating an application to another cloud provider complex.

Common mistakes

  • Opening direct database connections inside the handler: Creating a new relational database connection on every invocation quickly overwhelms connection pools under load; initialize clients outside the handler scope or use an HTTP-based data proxy.
  • Bundling oversized dependencies: Deploying large libraries slows down artifact unpacking and significantly increases cold start times.
  • Treating functions like stateful servers: Relying on local /tmp storage or in-memory variables across requests leads to intermittent bugs when requests hit newly provisioned instances.

FAQ

Does serverless mean there are no servers?

No. Physical and virtual servers still run the code, but the cloud provider handles operating system patching, capacity planning, hardware maintenance, and runtime scaling behind the scenes.

How does serverless differ from containers?

With containers, you package an entire application and configure scaling rules, networking, and cluster capacity. With serverless functions, you deploy individual event-driven handlers and delegate all instance lifecycle and scaling mechanics to the platform.

When should you avoid serverless architecture?

Avoid serverless for sustained high-CPU workloads, low-latency trading or gaming backends intolerant of cold starts, and monolithic applications that require long-lived local state.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.