Stateful serverless on Google Cloud with Cloudstate and Akka Serverless

Click for: original source

In recent years, stateless middle-tiers have been touted as a simple way to achieve horizontal scalability. But the rise of microservices has pushed the limits of the stateless architectural pattern, causing developers to look for alternatives. By James Ward, Developer Advocate at Google Cloud and Viktor Klang, Head of Cloud Engineering and Deputy CTO at Lightbend.

Stateless middle-tiers have been a preferred architectural pattern because they helped with horizontal scaling by alleviating the need for server affinity (aka sticky sessions). The stateless model pushed all “state” out of the middle-tier into backing data stores. In reality the stateless pattern just moved complexity and bottlenecks to that backing data tier.

New patterns are now emerging which fundamentally change how we compose a system from many services running on many machines. One approach, is to build an event-driven system that co-locates partitioned data in the application tier, while backing the event log in a durable external store. To take the fraud detection example, this means a consumer can receive transactions for a given customer, keep those transactions in memory for as long as needed, and perform real-time analysis without having to perform an external query. Each consumer instance receives a subset of commands.

Commands and queries in event driven system


By separating commands and queries we can easily achieve end-to-end horizontal scaling, fault tolerance, and microservice decoupling. The new Cloudstate open-source project attempts to enable building more approachable programming and operational models. Cloudstate’s programming model is built on top of protocol buffers (protobufs) which enable evolvable data schemas and generated service interaction stubs. When it comes to data schemas, protobufs allow you to add fields to event / message objects without breaking systems that are still using older versions of those objects.

You will also get video that walks through the full fraud detection sample and find the source for the sample on GitHub. Exciting!

[Read More]

Tags akka streaming scala serverless gcp