The underlying design of an AWS multiregion architecture can affect an application's use and performance. One particular application design issue for cross-region deployments is the use of stateful vs. stateless applications.
With a stateful application, each interaction or transaction depends on a particular system or resource. This may require continued interactions with that stateful resource, because it contains certain data elements carried between transactions or sessions.
By comparison, a stateless application eradicates any dependencies on specific client systems or resources. Every request must be independent of prior requests or sessions, which enables any resource to handle any transaction for any user. A distributed application, such as those that span multiple cloud regions, can significantly benefit from stateless application design.
Scalability is the principal benefit of a stateless application in an AWS multiregion deployment. Developers typically architect an application from a myriad of different cloud services and resources. When that application is duplicated across two or more regions, those cloud resources, along with the costs, are also duplicated.
If the application is stateful, user requests and corresponding transactions are typically tied to the application node in a given region. If one region is busy, it could force an organization to make additional expenditures to scale the application on the busier node, even if other regions are relatively free.
By contrast, an ideal stateless application can handle any request from any user on any node in any region. This enables all nodes to share the overall user load and reduce the need to tweak resources provisioned to specific regions. Stateless applications make workload deployments more uniform and better support automated tasks, such as application templates, provisioning and scaling.
When some stateful details must be retained or shared, application architects may prefer an in-memory object caching mechanism, such as Redis or Memcached, or a distributed database, such as Cassandra, all of which are designed to support stateless applications.