For companies like Tesla, Netflix, and Epic Games’ Fornite (all Akka users), low latency systems that harness real-time data have turned these former market challengers into market leaders. When the advantage of mere milliseconds translates into a competitive edge, the ability to quickly access and coordinate your application's data (often referred to as application “state”) matters. A lot.
To capture these mere milliseconds and deliver a better UX faster than ever before, businesses have started to embrace the Serverless paradigm to capture compute efficiencies without requiring the hardware, infrastructure management, or expertise like before.
Yet in its current implementation as Function as a Service (FaaS), serverless is falling short for data-intensive use cases due to the limitations of stateless functions and the difficulty of cobbling together different services with databases and infrastructure components. This leaves developers jumping through hoops when it comes to building complex enterprise services without having application state close at hand.
Not long ago, our needs for application data were pretty simple: the rule of thumb was to put our data into SQL databases and call it whenever needed. As data began to play an increasing role in providing customer value and meeting their expectations, making it available in real-time meant taking a different approach to data storage and access.
Industry leading organizations started to see data-centric, stateful services as one piece of the puzzle, with cloud infrastructure, Kubernetes, and stateless functions (like AWS Lambda) appearing later to fill the gaps.
This presents some tradeoffs for developers to consider when looking at serverless:
On one hand, stateless functions are familiar and easy to work with, yet they aren’t ideal for complex, data-centric services at high scale. For example, as API requests are made to update a user’s session state, the application must fetch the current state from the database–and save it as well–before a response can be provided, adding unnecessary latency and additional possible points of failure. As the system grows in complexity, latency and the cost to operate this system in a serverless environment also increases.
On the other hand, stateful functions require more consideration in the learning and design phase, but they do eliminate the need for reading and re-reading the state from the database for each operation, saving milliseconds of latency each time and reducing database processing overhead.
At Lightbend, we believe that stateless functions have a role to play in modern serverless applications, but that can’t be the only part of the story. The problem is that focusing exclusively on a stateless design ignores the hardest part in distributed systems: literally, managing the state of your data. This is why we created Akka Serverless.
Akka Serverless provides a developer platform for building stateful entities for serverless that is easy to use, requires no ops or infrastructure management, and has a set of APIs and capabilities that accelerate developer velocity. It keeps application data close by, utilizing in-memory state backed by a persistent event log. This democratizes complex data access patterns like Event Sourcing, CQRS, and CRDTs and lets developers build more advanced, data-intensive services that leverage stateful entities with the lowest latency processing possible.
In this blog series, we’ll explore the benefits of serverless, the limitations of stateless functions, the added value of stateful entities for advanced use cases, and the data access patterns needed–beyond continuous database roundtrips–to be successful with serverless application development.