Statelessness
Stateless is the preferred model when writing a serverless FaaS function. Why? Because in the fully managed execution environment, which can be scaled up and down at anytime, we cannot expect our function state to be preserved. So it is best to not save anything to the function's local storage. If we need memory, such as global variables that may be shared across instances of the function, these variables must be managed explicitly by external storage services.
In some situations, saying a function is completely stateless makes us underutilize the execution context of that function. As we already know, our function is actually running inside a container isolation. And it is completely fine for our function to write some things ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access