By: IBM Cloud Education

In this guide, discover how the serverless programming model is a simpler, more cost-effective way of building and operating applications in the cloud.

What is serverless computing?

Serverless is an approach to computing that offloads responsibility for common infrastructure management tasks (e.g., scaling, scheduling, patching, provisioning, etc.) to cloud providers and tools, allowing engineers to focus their time and effort on the business logic specific to their applications or process.

The most useful way to define and understand serverless is focusing on the handful of core attributes that distinguish serverless computing from other compute models, namely:

  • The serverless model requires no management and operation of infrastructure, enabling developers to focus more narrowly on code/custom business logic.
  • Serverless computing runs code only on-demand on a per-request basis, scaling transparently with the number of requests being served.
  • Serverless computing enables end users to pay only for resources being used, never paying for idle capacity.

Serverless is fundamentally about spending more time on code, less on infrastructure.


While there are many individual technical benefits of serverless computing, there are three primary benefits of serverless computing:

  • It enables developers to focus on code, not infrastructure.
  • Pricing is done on a per-request basis, allowing users to pay only for what they use.
  • For certain workloads, such as ones that require parallel processing, serverless can be both faster and more cost-effective than other forms of compute

Understanding the serverless stack

Defining serverless as a set of common attributes, instead of an explicit technology, makes it easier to understand how the serverless approach can manifest in other core areas of the stack.

  • Functions as a Service (FaaS): FaaS is widely understood as the originating technology in the serverless category. It represents the core compute/processing engine in serverless and sits in the center of most serverless architectures.
  • Serverless databases and storage: Databases and storage are the foundation of the data layer. A “serverless” approach to these technologies (with object storage being the prime example within the storage category) involves transitioning away from provisioning “instances” with defined capacity, connection, and query limits and moving toward models that scale linearly with demand, in both infrastructure and pricing.
  • Event streaming and messaging: Serverless architectures are well-suited for event-driven and stream-processing workloads, which involve integrating with message queues, most notably Apache Kafka.
  • API gateways: API gateways act as proxies to web actions and provide HTTP method routing, client ID and secrets, rate limits, CORS, viewing API usage, viewing response logs, and API sharing policies. 

Comparing FaaS to PaaS, containers, and VMs

While Functions as a Service (FaaS), Platform as a Service (PaaS), containers, and virtual machines (VMs) all play a critical role in the serverless ecosystem, FaaS is the most central and most definitional; and because of that. it’s worth exploring how FaaS differs from other common models of compute on the market today across key attributes:

  • Provisioning time: Milliseconds, compared to minutes and hours for the other models.
  • Ongoing administration: None, compared to a sliding scale from easy to hard for PaaS, containers, and VMs respectively.
  • Elastic scaling: Each action is always instantly and inherently scaled, compared to the other models which offer automatic—but slow—scaling that requires careful tuning of auto-scaling rules.
  • Capacity planning: None required, compared to the other models requiring a mix of some automatic scaling and some capacity planning.
  • Persistent connections and state: Limited ability to persist connections and state must be kept in external service/resource. The other models can leverage http, keep an open socket or connection for long periods of time, and can store state in memory between calls.
  • Maintenance: All maintenance is managed by the FaaS provider. This is also true for PaaS; containers and VMs require significant maintenance that includes updating/managing operating systems, container images, connections, etc.
  • High availability (HA) and disaster recovery (DR): Inherent in the FaaS model with no extra effort or cost. The other models require additional cost and management effort. In the case of both VMs and containers, infrastructure can be restarted automatically.
  • Resource utilization: Resources are never idle—they are invoked only upon request. All other models feature at least some degree of idle capacity.
  • Resource limits: FaaS is the only model that has resource limits on code size, concurrent activations, memory, run length, etc.
  • Charging granularity and billing: Per blocks of 100 milliseconds, compared to by the hour (and sometimes minute) of other models.

Use cases and reference architectures

Given its unique combination of attributes and benefits, serverless architectures are well-suited for use cases around data and event processing, IoT, microservices, and mobile backends.

Serverless and microservices

The most common use case of serverless today is supporting microservices architectures. The microservices model is focused on creating small services that do a single job and communicate with one another using APIs. While microservices can also be built and operated using either PaaS or containers, serverless has gained significant momentum given its attributes around small bits of codes that do one thing, inherent and automatic scaling, rapid provisioning, and a pricing model that never charges for idle capacity.

API backends

Any action (or function) in a serverless platform can be turned into a HTTP endpoint ready to be consumed by web clients. When enabled for web, these actions are called web actions. Once you have web actions, you can assemble them into a full-featured API with an API Gateway that brings additional security, OAuth support, rate limiting, and custom domain support.

API backends

For hands-on experience with API backends, try the tutorial “Serverless web application and API.”

Data processing

Serverless is well-suited to working with structured text, audio, image, and video data around tasks that include the following:

  • Data enrichment, transformation, validation, cleansing
  • PDF processing
  • Audio normalization
  • Image rotation, sharpening, and noise reduction
  • Thumbnail generation
  • Image OCR’ing
  • Applying ML toolkits
  • Video transcoding
Data processing

For a detailed example, read “How SiteSpirit got 10x faster, at 10% of the cost.”

Massively parallel compute/“Map” operations

Any kind of embarrassingly parallel task is very well-suited to be run on a serverless runtime. Each parallelizable task results in one action invocation. Possible tasks include the following:

  • Data search and processing (specifically Cloud Object Storage)
  • Map(-Reduce) operations
  • Monte Carlo simulations
  • Hyperparameter tuning
  • Web scraping
  • Genome processing
Massively parallel compute/“Map” operations

For a detailed example, read How a Monte Carlo simulation ran over 160x faster on a serverless architecture vs. a local machine

Stream processing workloads

Combining managed Apache Kafka with FaaS and database/storage offers a powerful foundation for real-time buildouts of data pipelines and streaming apps. These architectures are ideally suited for working with all sorts of data stream ingestions (for validation, cleansing, enrichment, transformation), including:

  • Business data streams (from other data sources)
  • IoT sensor data
  • Log data
  • Financial (market) data

Get started with tutorials on serverless computing

Expand your serverless computing skills with these tutorials:

Serverless and IBM

IBM Cloud Functions is a Function-as-a-Service (FaaS) platform that executes code in serverless environments.

IBM Cloud Functions is based on Apache OpenWhisk (an open source project developed by IBM) and works to speed and simplify the development process. Developers can leverage IBM Cloud Functions in combination with other products/tools in IBM Cloud, including IBM Watson APIs, Cloudant, Object Storage, Event Streams and many others.

Users of the IBM Cloud Functions platform pay only for actual use. To get started, create your IBM Cloud account.

Follow IBM Cloud

IBM Cloud News connects you to insight and information you can put to work right away—straight from the minds of IBM Cloud experts, IBM customers, and business and IT leaders.

Email subscribeRSS

Be the first to hear about news, product updates, and innovation from IBM Cloud