Emerging Approaches to Building Stateful Applications using Containers

David Linthicum, Chief Cloud Strategy Officer at Deloitte Consulting - writes about Stateful Applications in Containers

David S. Linthicum, Cloud Computing Expert

With all the known benefits of application containers, there is a common misperception that containers are only good for stateless microservices style applications.  When applied to cloud and non-cloud container-based applications, many IT organizations decide to avoid stateful application use cases.

Don’t make that decision too fast. There’s a new understanding of what can be achieved with containers (infographic). With the rise of external technologies, not only can you create stateful applications using containers, but perhaps applications that have more abilities than traditional stateful applications.

Let’s look at how we deal with state. Typically, we store application state in external persistent storage, such as a cache, file, or database. This means that state can be remembered across operations. However, state must always be written back to persistent storage.

In the case of containers, you can maintain state within the container. However, the best approach is to maintain state outside of the container. This cleanly separates behavior from the data, which is desirable since all container instances can participate in the operations of a single application, as long as they are able to write and read to a common state.

The advantage of this approach is that you can launch as many containers as you need and they can jump right on and pick up a workload by using state as a starting point. This allows the containers to scale by leveraging clusters. Once they have carried out a specific behavior, they write state, and return to the resource pool. Other application containers can pick things up from there, with the containers working along with state to carry out whatever they are programmed to do.

Another issue is that container-based applications need to survive application restarts and outages. This means that state not only keeps track of the progression of application operations, but keeps the ability to resume where the application left off in case the cloud provider, network, physical servers, or other resources go down.

Steps to Success

The steps to success are easy to understand when dealing with containers and state.

First, determine your application requirements. In many instances, applications are made stateful or stateless without understand what they need to do. Single containers that perform a narrow range of behaviors are typically stateless, whereas more complex applications made up of many containers are typically stateful.

Second, figure out where you’re going to maintain state. As a rule, it’s going to be a persistent storage system outside of the container, which decouples behavior from the state. This architectural approach provides more flexibility and better scalability.

While maintaining the state at the container level can be pursued at the Docker Storage Plug-in level, maintaining the overall state across multiple containers typically clustered and storage volumes that represent an entire Application is more complex, and with Docker simple plug-in, might not be easy to achieve.

Finally, make sure to consider your approach to maintaining state when testing. Issues often arise when state is not correctly maintained, and testing the container-based application’s state maintenance capabilities needs to be part of your automated testing procedures.

While maintaining state is nothing new, the use of state as part of containers is. As we progress forward, new innovations could make state retention for container-based applications as easy as flipping a switch.

David Linthicum, Chief Cloud Strategy Officer at Deloitte Consulting - writes about Stateful Applications in Containers

David S. Linthicum is a cloud computing expert, an internationally recognized industry expert and a thought leader. Dave has authored 13 books on computing, the latest of which is Cloud Computing and SOA Convergence in Your Enterprise, a Step-by-Step Approach. Dave’s industry experience includes tenures as CTO and CEO of several successful software companies, and upper-level management positions in Fortune 100 companies. He keynotes leading technology conferences on cloud computing, SOA, enterprise application integration, and enterprise architecture. Dave writes the Cloud Computing blog for InfoWorld. His views are his own.
https://twitter.com/DavidLinthicum

mm

Author Guest Blogger

More posts by Guest Blogger