Fn Project and Open Source FaaS

Fn Presentation

The talk started with some history on the speaker, Chad Arimura, and some of the companies he's launched, as well as a few obligatory slides to level set things ("What is serverless?"). After the brief pre-amble, Chad got into the meat of the presentation, which was close to the quickstart on the Fn github page. There were some important additions, like "hot functions", and the presentation included gracefully fielding some questions like "Why is this a thing?".

Chad pointed people to this post on Medium several times for understanding the purpose and application of Fn:

The "put it on a bumper sticker" explanation was "multi-cloud, open source lambda", and that was good enough to get my attention.

Incidentally, "hot functions" are functions that persist once the container they are run in is built. This avoids the penalty of container build on invocation, so if you are say, serving an endpoint from Fn, you want to use a hot function so that the first invocation is slow (700ms in the demo), but subsequent calls to your endpoint are much more reasonable response times (50-70ms in the demo).

There's a lot more, like a quick dive into the architecture. The docs on running Fn in production have a good overview that looks a lot like the architecture slides from the talk. There's integration with Prometheus & Grafana as well as other monitoring solutions, and Helm charts for Kubernetes deployment. There was a also a brief foray into Flow, and a cool demo where a Flow glued together a lot of different functions asynchronously that were dependent on each other; the end result was a flow that scraped Flickr for pictures of cars, then kicked off jobs to detect the license plates in the images and render rectangles highlighting them, as well as run them through OCR to detect the plate, and finally, post to the updated images to Slack along with the plate. The only thing missing to make this a super valuable tool to your local law enforcement was a step to query the plate and see if it is stolen. Alternatively, the flow could also post the end result content to Twitter.

Post Meetup Follow Up

The talk sparked my interest. I decided to run through the quickstart and a few things in the github repo to check it out. The quickstart is crazy easy.

I had most of the prerequisites, so I did:

brew install fn
fn start
mkdir -p fnproject/hello
cd $!

Then I created a simple golang program based on the docs with this content, named func.go:

Summary

While there are other contenders that are similar, like Kubeless or OpenFaaS, I thought the Fn Project was impressive. Admittedly, I haven't spent a lot of time digging into the alternatives, and mention them mostly for completeness sake. If you are in a committed relationship with Kubernetes, Kubeless might be a better choice due to its tight integration with Kubernetes; it uses CRDs, which is also on the roadmap for Fn, but it's in Kubeless right now. OpenFaaS looks like it has a lot of similar features (including Flow), but I think the documentation for Fn Project seems a bit more clear and complete, and it looks a bit more modular in design, with multiple options for underpinning services like database and message queue. Overall, if you are considering deploying (or contributing to!) a FaaS framework, the Fn Project is worth a look.