Here we will discuss a simple proof of concept (POC) for a serverless computing implementation using containers.
Note that the following POC is of an educational nature. It serves to demonstrate how one could go about implementing a serverless infrastructure and what logic is typically required; the discussion of its limitations at the end of this appendix will likely be of the most value for you, should you decide to roll your own infrastructure.
So, what is necessary to implement a serverless infrastructure? Astonishingly little, as it turns out: I created a POC called Flock of Birds (FoB), using DC/OS as the underlying platform, in a matter of days.
The underlying design considerations for the FoB proof of concept were:
The service should be easy to use, and it should be straightforward to integrate the service.
Executing different functions must not result in side effects; each function must run in its own sandbox.
Invoking a function should be as fast as possible; that is, long ramp-up times should be avoided when invoking a function.
Taken together, the requirements suggest a container-based implementation. Now let’s have a look at how we can address them one by one.
FoB exposes an HTTP API with three public and two internal endpoints:
POST /api/gen with a code fragment as its payload generates a new function; it sets up a language-specific sandbox, stores the user-provided code fragment, ...