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. When an application is stateless, the server does not store any state 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. In this approach to software development, session data is stored locally on the end user's device when internet connectivity is unavailable and uploaded and replicated in the cloud when a connection becomes available. The distributed architecture that makes horizontal scalability possible in cloud computing has driven renewed interest in stateless apps and stateless app components. One reason is because when an app's components are stateless, they can easily be redeployed in the event of a failure and scaled out to accommodate load changes. Another reason is that when apps are stateless, they can easily be connected to other apps through application program interfaces (APIs). Functional programming, which is often used for microservices and containerization, has also driven interest in stateless apps. Functional programming is an approach to software development that uses very small segments of immutable code. Each function executes its task as if it was for the very 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 having to worry about dependencies breaking the program. |
No comments:
Post a Comment