Welcome to Kenny-s Blog

stateless app

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 is not dependent upon data from a previous session.

In contrast, a stateful application saves data about each client session. Information saved from the previous session allows the app to provide the client with a personalized response. Because maintaining state is extremely useful, programmers have developed a number of techniques to add state, including browser cookies and RESTful APIs that interconnect apps and services.

The distributed architecture that makes horizontal scalability possible in cloud computing has driven renewed interest in stateless apps and stateless app components. When an app’s components are stateless, they can be redeployed if something fails and scaled to accommodate load changes. There are no dependencies and nothing is saved in another instance that somehow has to be “remembered” by the next transaction.

An important challenge for developers who design mobile apps is make sure the app will work as expected, even if there is no network connection and previous session data is not available. With an offline first approach, applications are designed for resource-constrained environments and fewer dependencies. Developers using this approach put an emphasis on building stateless processes that can become stateful when resources are not so constrained.

Similarly, the idea of functional programming is being explored for microservices. Functional programming uses very small segments of immutable code that can never be changed. Each function executes its task as if it were for the very first time and is not dependent upon any other function in the program. Because all the parts of the program are stateless, programmers have the ability to put the pieces together in multiple ways without having to worry about dependencies breaking the program.

Have something to add? Share it in the comments.

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