Lightbend has launched a new open-source serverless framework to take on the next generation of serverless. CloudState aims to go beyond the normal stateless functions most serverless initiatives take on today.

RELATED CONTENT: Rethinking the way you build software with serverless

According to Jonas Bonér, CTO at Lightbend, today’s current serverless movement focuses a lot on automation and infrastructure, but neglects requirements at the application layer. This is because data, streaming and event-driven stateful architectures can be challenging, he explained.

“The next generation serverless platform and programming model will take a more holistic grip on the whole system, end-to-end, and allow general-purpose application development—e.g. microservices, fast data, streaming pipelines, AI/ML, etc. It will let us implement common use-cases such as: shopping carts, user sessions, transactions, ML model training serving, low-latency prediction and recommendation serving, anomaly detection, job scheduling, and much more,” Bonér told SD Times. “What we are missing is support for long-lived virtual stateful functions, a way to manage distributed—durable and ephemeral—state in a scalable and available fashion, ways to co-locate processing and data, and options for choosing the right consistency model for the job.”

Serverless is also often thought of as function as a service (FaaS). While FaaS is a part of serverless, serverless is really about bringing developers and operations teams new experiences by taking away infrastructure provisioning concerns, Bonér said.

“It’s no question that FaaS has been ground-breaking, but it is with its ephemeral, stateless, and short-lived functions, only the first step towards this new Serverless Developer Experience. Stateless functions are great for processing intensive, parallelizable workloads, moving data from A to B providing enrichment and transformation along the way, but are quite limited and constrained in what use-cases it addresses well, which makes it difficult and inefficient to implement complete general-purpose applications,” said Bonér. “CloudState enables to build any application in this new experience, not just specific use-cases. And the missing piece is ways to manage distributed state—your data—reliably, at scale.”

According to the CloudState team, it was designed for event-driven architecture, event sourcing, CQRS, cluster sharding, co-location of data and processing, and other common distributed patterns. The project tackles stateful use cases such as training and serving machine learning models; low-latency real-time prediction and recommendation serving, fraud detection and anomaly detection; and shared collaborative workspaces.

The open-source project consists of two parts:
A standards effort that will work towards defining a specification, and protocol between use functions and the backend
A reference implementation for the backend and set of client API libraries in different language

The project is also polyglot in terms of client API libraries and database support. It currently supports JavaScript, Java, SQL and NoSQL. Support for Go and Scala are in the works. It also includes two state implementations: event sourcing and conflict-free replicated data types.

“CloudState takes away the data access as a responsibility for the application developer and in return offers a clean domain state API so that services can be business code focused,” said Bonér.