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 onto the local storage during execution, of course, without the expectation to share states outside this isolation. When saying stateless in the container's context, it is likely to be the share-nothing model rather than being stateless. The share-nothing model, is the better word to generally describe the statelessness of container-based FaaS.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset