WhatIs.com

stateless app

By Paul Kirvan

What is a stateless application?

A stateless app is an application program that does not save client data generated in one session for use in the next session with that client. Each session is carried out as if it was the first time and responses are not dependent upon data from a previous session.

In contrast, a stateful application saves data about each client session and uses that data the next time the client makes a request. The term stateless also is used in connection with networking, particularly when applied to stateless firewalls.

When an application is stateless, the server does not store data or other information about the client session. Instead, the session data is stored on the client and passed to the server as needed. This is an important consideration when developing apps with offline first in mind.

With an online first approach to software development, session data is stored locally on the user's device when internet connectivity is unavailable. It is then uploaded and replicated in the cloud when a connection becomes available.

The importance of stateless technology

The distributed architecture that makes horizontal scalability possible in cloud computing has driven renewed interest in stateless apps and stateless app components. There are two reasons for this:

  1. When an app's components are stateless, they can easily be redeployed in the event of a failure and scaled out to accommodate workload changes.
  2. When apps are stateless, they can easily be connected to other apps through application programming interfaces, or APIs.

functional programming, which is often used for microservices and containerization, has also driven interest in stateless apps. It's an approach to software development that uses small segments of immutable code. Each function executes its task as if it is for the first time and is aware of, but not dependent upon, other functions in the program. Because all the program's parts are stateless, programmers can assemble functions in multiple ways without worrying about dependencies breaking the program.

Stateful vs. stateless applications

Most applications in use today are considered stateful. However, the use of stateless applications is increasing. The popularity of Cloud services, microservices and containers are driving this trend.

Without access to user data as is the case with stateless apps, there is greater dependence on clients to have the power to acquire the necessary state data and link it with stateless apps when needed. Cloud services have the computing resources needed to easily accommodate stateless apps.

Nevertheless, stateful apps remain popular. Several factors are behind their continued use:

Another reason for the popularity of stateful services and apps is their ability to use of databases and servers to supplement user data storage. As a result, they interact quickly with users and make efficient use of computing power.

Stateless applications are typically compatible with User Data Protocol, Domain Name System and Hypertext Transfer Protocol. Stateful apps are compatible with fiber to the premises and Telnet protocols, among others.

Stateless apps and containers

Providers initially envisioned containers as supporting stateless applications. However, over time the trend has been for containers to support both stateless and stateful applications. This is important because microservices and cloud computing continue to grow in popularity.

Packaging all relevant components within a container makes it easy to move from one environment to another. This is where microservices and cloud services are appropriate platforms.

Pros and cons of stateless apps

There are advantages and drawbacks to using stateless applications:

Advantages

Drawbacks

Examples of stateless apps

Stateless applications are used in several ways:

Learn more about state and the concept of change in modern application design.

16 Dec 2022

All Rights Reserved, Copyright 1999 - 2024, TechTarget | Read our Privacy Statement