Snafu – The Swiss Army Knife of Serverless Computing

by Josef Spillner

The Service Prototyping Lab at Zurich University of Applied Sciences is committed to advancing the state of technology for bringing applications to the cloud, for the benefit of the society of large in general and of the local industry in particular. This obliges us to closely monitor industrial trends along with academic advances. A hot topic currently found in both is the higher-PaaS-level service class of FaaS, or Function-as-a-Service, which coincides with the marketing term Serverless Computing. We have already contributed analytical work on finding the limits and possibilities of today’s FaaS systems (preprint), and engineering work on translating legacy monolithic code into fine-grained functions (preprint). It was only a matter of time until the limits in both commercially operated FaaS services and open-source FaaS prototypes became too severe for our work. Hence, after a careful analysis of what is available, we decided to come up with an alternative FaaS host process design. The design led to an architecture, and the architecture eventually to an implementation called Snafu. This post presents Snafu and positions it as Swiss Army Knife for situations in which functions should be prototyped, tested or hosted.

In computer engineering, a Swiss Army Knife is a software tool which can be used in versatile ways. No matter whether client side or server side, the tool should offer several functions for achieving results and for figuring out any issues which may occur on the path to the achievement. Snafu is designed with this philosophy: It should be flexible to use for hosting and invoking functions rapidly.

Snafu functions are supplied as source or bytecode files (Python 2, Python 3, Java 8) which are simply dropped into the functions folder and parsed dynamically. All functions or methods found are offered for execution. There is no need to configure anything, although configuration is possible, for instance to specify a single function handler.

Functions can be executed in-memory/in-process (for Python 3 only as it is the implementation language of Snafu itself), through external interpreters (Python 2, Java), or through static proxies and dynamically allocated Docker containers. The trade-off between execution speed, isolation and scalability can thus be determined by the user and is not imposed by the provider.

The resulting implementation of Snafu runs as command-line utility to host the functions locally and to invoke them interactively, in batch mode, or through various triggers. Compatibility with AWS Lambda is achieved through the Snafu control plane which supports multi-tenancy, multi-threading, AWS4 authentication, and forwarding of requests for higher scalability. Furthermore, existing Lambda deployments may be migrated into Snafu instances by just running snafu-import.

Click to show the diagram in full size.

The choice of FaaS as programming and deployment model is both a technical and an economic one. The following sketch shows which parameters influence the feasibility to run a self-administered FaaS hosting system inside a virtual machine compared to using an existing commercial FaaS service which is typically part of a larger PaaS offering. Our experiments with Snafu have shown that at least for certain functions, self-hosting is quite competitive and exceeds both the performance barrier and the cost utility.

While Snafu is still an early prototype, it already fills the gap for FaaS frameworks useful for quick prototyping of new cloud and network services and for in-house/private cloud deployments of a high-performance function execution environment. The extensible nature will lead to many useful additions in the future. Implementing Go functions? Triggering code analysis and unit testing functions from commits? Billing per formal function complexity? Snafu is well positioned as starting point for such tasks.

Apart from the technical perspective, Snafu is aligned with our goal of advancing Switzerland’s leadership in ICT by driving innovation on future and emerging cloud technologies such as FaaS.

Snafu is publicly available via its Git repository. A preprint with all the technical details (design, architecture, implementation) as well as measurement results and metrics is also publicly available via arXiv CoRR. Comments and reviews are solicited publicly at ShortScience.

Event notice: We will give a presentation and live demo of Snafu at the Future Cloud Applications event on the 27th of April 2017 in Winterthur. You are invited to join!


Leave a Reply

Your email address will not be published. Required fields are marked *