Welcome to Kenny-s Blog

stateful app

A stateful app is a program that saves client data from the activities of one session for use in the next session. The data that is saved is called the application’s state.

Apps can be stateful or stateless. When an app is stateful, client data is either stored locally or on a remote host until the user logs out or the session expires after a predetermined time limit. The session data that is saved to persistent disk storage is accessible to the server, to the client and to other applications.

HTTP, on the other hand, is inherently stateless. A web server does not retain information from multiple sessions, so when a state is needed for a web app, it must be built in. If desired, stateful features can be built in with dynamic pages. These pages can retain sessions by way of web address variables and server- and client-side stored data. Cookies are a common way such data is stored.

Most desktop applications and operating systems are stateful. In the early days of cloud computing, however, developers were encouraged to build stateless apps, because stateful apps didn’t scale well in the cloud’s distributed, virtualized architecture. Limiting data stores to specific locations was difficult in an environment where virtual machines themselves were stateless; the result was that stateful apps moved straight to the cloud often became unstable.

Containerization may be changing that. This OS-level virtualization method for deploying and running distributed applications, without launching an entire VM for each application, allows files to be pulled into the container on startup, and persist somewhere else when containers stop and start. Google’s Kubernetes 1.3, for example, adds support for stateful applications in a product called Pet Sets, which allows for hosts to be named and persist beyond container restarts. FlexVolume and Mesos also provide persistent volumes for containers’ state data.

Have something to add? Share it in the comments.

Your email address will not be published. Required fields are marked *