We’re pleased to announce the general availability of Pivotal Cloud Cache V1.1 featuring session state caching. In this post we’ll cover some details of this release, including a demo that shows you exactly how easy it is to adopt this feature without making any changes to your application, but first I would like to paint a picture of why this is important.
IT Infrastructure Capacity Needs to Flow Like Water
To truly appreciate the effort it takes to deliver a good user experience one has to know a bit about what goes on under the covers with the IT infrastructure. Web applications have to survive crashes, and handle constant changes or reconfigurations of the underlying infrastructure, without disrupting the user’s session or losing data.
These events are either un-intentional, i.e. a server crashes, or operationally initiated like adding or removing instances of microservices to re-align capacity, performing rolling upgrades, etc.. Regardless of the circumstances that lead up to the change, the solution is the same – elasticity and resilience built into the platform. Some would argue that we even need to go beyond resilience, by building ‘anti-fragile systems’ that actually benefit from shocks and thrive and grow when exposed to volatility.
To grasp the degree of volatility in the platform and infrastructure, one needs only to look at the data on containers and their average lifespan. A Datadog study came up with 2.5 days as the average lifespan of Docker containers, while a New Relic study came up with 9.25 hours. The trendline is clear – container lifespan is shrinking down to hours or even minutes.
Cloud-native architectures need elasticity to quickly go from 1 to 100 instances of a microservice and back down to 1. The infrastructure has to be ‘liquid’ and flow to where it is needed, much like a ‘smart’ watering system with sensors that deliver just enough water to keep plants healthy. Moisture sensing systems can save up to 70% of water for an average household, which amounts to an average saving of 8,800 gallons of water annually per home! Similarly, what’s needed for IT is a pool of re-usable capacity which is allocated and continuously reallocated on the basis of need – with no more or no less capacity than what is needed at any given time.
Maintaining Continuity in the Context of Change
An environment where change is the norm requires some special considerations with respect to data, which has to be durable across changes to the infrastructure.
Applications generate data, which populates the app’s database, to do its job or to store user generated changes. Customer data, user preferences, orders, product data and pricing are all examples of application data. This data has to be durable until it is explicitly changed by the application or the operator.
There is another, less familiar, type of data that goes to the heart of business continuity. This is session state data, and it relates to each user’s state and application interactions. This data has a lifespan that extends only to the end of each session. Having this state data saved externally, rather than embedded within the application, is critical to supporting the type of IT dynamism cloud native applications need (see 12 factor application principles).
Session state caching is how users don’t feel a big impact from changes to the underlying infrastructure. If any part of the infrastructure underneath the session becomes unavailable, the user interaction can still proceed without losing context. This happens because new microservice instances can be dynamically spun up to compensate for failures, or to modify capacity, and these instances can be onboarded with the user’s context from an external source that maintains state information. Having this state information available externally shields users from infrastructure changes by making it possible to provide good performance and availability despite these changes.
Session state caching is vital to business continuity and user experience, which is why we are delivering it as a pre-configured option in Pivotal Cloud Cache.
Pivotal Cloud Cache – Now with Session State Caching
Putting session state information in a cache is common practice because this data has to be accessible fast, highly scalable and available. Using PCC for session state caching minimizes the transition time across change boundaries, keeps the session data highly available, and ensures that the session state data itself can be scaled as needed.
Purpose Built for Developer Self Service
Session state caching in PCC was designed with ease of use by developers in mind. Developers simply choose PCC in the Pivotal Cloud Foundry Marketplace and create a cluster with the session state option specified. This can be done by adding a single option to the command when you create your PCC cluster. If you choose this option, then you are in effect using your cluster for storing session state information in the cluster.
My colleague, Cornelia Davis shows us how easy it is in this demo:
Note that the use of session state caching did not require any change to the application code.
Backed by the Power of Pivotal Cloud Cache and Pivotal Cloud Foundry
Session state caching benefits from all the enterprise grade performance and availability features in PCC. Data is sharded across partitions on separate servers so that retrieval can occur in parallel across all partitions and servers. In-memory data can be accessed much faster than disk, sometimes by a factor of 100 or more. Horizontal scalability means that servers can be added to a cluster to increase capacity. Data redundancy means that failures are recoverable by accessing copies of data that is lost in the failure. This can be set up so that data is replicated across availability zones in PCC, and a cluster can survive the failure of an entire availability zone.
The fact that PCC is a service on Pivotal Cloud Foundry means that PCC and session state caching inherits all the lifecycle management provided by the platform. Pivotal Cloud Foundry’s automated management provides logging, monitoring, failure recovery, and ensures that software updates can occur with zero-to-minimal downtime.
Operators can customize service plan definitions to support internal chargeback packages and enforce resource constraints. Operators can place quotas and limits on service instance counts to keep infrastructure costs under control.
Within these constraints imposed by operators, developers have full autonomy for easily creating cache clusters when they need them.
Summary
Session state caching is often the first stop for those who are adopting in-memory caching – the benefits of this use case for caching are solid, easy to understand, and proven repeatedly. The question around session state caching is not whether it is a good idea, but rather how best to go about it to make it as easy as possible. This is the goal we set for ourselves with PCC session state caching – make it easy for developers.
Give it a spin.
PCC V1.1 Download: https://network.pivotal.io/products/p-cloudcache
PCC Product Page on Pivotal.io: https://pivotal.io/platform/services/data-management/pivotal-cloud-cache