Build a serverless framework at home: Go on, bit of open sourcey hijinx won't hurt

Rifling through riff: Another option that's not Amazon's Lambda

Seduced by serverless functions? Lured by Amazon's Lambda? If so, why not build a serverless framework at home? Project riff, an open source serverless platform from EMC/VMware spinoff Pivotal Software, aims to let you do just that.

First unveiled at SpringOne Platform in December, riff is still an early project. It emerged from the Spring Cloud Data Flow, a data integration project to run Java code as microservices created under Pivotal's open source Java-focused Spring framework.

"Riff is the next step in that evolution," says Jürgen Leschner, a riff organiser who works at Pivotal. Instead of running microservices that persist in containers, serverless models hide the containers from the developers and operations teams entirely. Instead, when a developer calls a software function, the container orchestration system (in riff's case, Kubernetes) spins one up and then kills it off silently.

Serverless functions are also known as functions as a service (FaaS). Events typically trigger them. "It’s a more function-oriented, Lambda-inspired model, where the code doesn’t get deployed until an event is detected by the platform," Leschner explains.

"We're taking the event-based integration and the way of deploying code in a function service and combining them. That's what riff is," he continues. Riff is also open source, which stands in stark contrast to Amazon's Lambda. The problem with Lambda is that it is specific to Amazon's APIs. It's a Faustian bargain for developers, giving them extensive functionality at a cost.

Avoiding the roach motel

"From a cloud provider perspective, it's a great way to lock people into your platform," says Chris Aniszczyk, chief technology and operating officer at the Cloud Native Computing Foundation. "Once you have a ton of these serverless functions running in a Lambda or Azure Functions and you’re intimately tied into their fancy image detection APIs and so on, it’s very hard to leave. It's a roach motel situation where you get stuck."

It is perhaps unsurprising, then, that Pivotal isn't the only company trying to find alternatives. CNCF has documented a bunch of open-source serverless projects. Some, like riff, OpenFaaS, Kubeless, Fission, and OpenLambda, are designed to run natively atop the CNCF’s Kubernetes. Many others, like IronFunctions and Apache’s OpenWhisk (that IBM uses for its Cloud Functions serverless offering), may not be native to Kubernetes but are still open source.

The benefits of open source serverless

What do these open source serverless options bring to the party? Unless you're using them to slurp services on the AWS platform and minimise container fees by weeding out idle compute power, why bother?

Efficiency for developers is one driver, says Leschner. "Developers don’t have to worry about building the connectors and boilerplate stuff into their code. They can package a simpler project and the boilerplate is already in the platform."

Inside riff

Riff handles this application wiring using several components inside a Kubernetes pod. A language-specific function invoker supporting Java, Python, JavaScript or shell languages, invoking functions written in the language of choice and packaged into containers.

The platform invokes functions in response to instructions from a sidecar, which is a software component that moderates communications between an event broker and the invoker. When an event happens, such as a transaction by a user, a signal in an IoT device stream or a notification from a monitoring service, the sidecar gives the invoker the event topic, and the invoker calls the appropriate function.

These benefits are what caused managed container orchestration firm Platform9 to write riff rival Fission. "We were wondering why it took so long to learn how to use containers and retool applications. There had to be a better way," according to CEO Sirish Raghuram (also, incidentally, a VMware refugee). "Containers and Kubernetes have a lot of power, but this whole 12-factor thing is so complex for people to grok and adopt. Can we make this simpler?"

There are also some operational efficiencies inherent in roll-your-own serverless platforms. Riff scales functions by enabling DevOps teams to write YAML files that specify system resources including the number of instances that run concurrently to support a function.

"On the operational side, the scaling and the automatic deployments make operations easier," Leschner asserts. "DevOps engineers don’t have to worry so much about monitoring and keeping things running because the platform takes care of more of that for you."

When it comes to operations, performance could quickly become prohibitively laggy in a serverless environment. Imagine having to spin up a container behind the scenes every time you want to call a class method. "If you're responding to a human being waiting for something, then for those use cases it might matter," says Leschner. "For integration uses it's less important."

His comment is a good argument against serverless maximalism: FaaS might be great for stateless short-lived applications like REST APIs and chatbots, but not for everything else. "There is a spectrum of options, and if someone is going to tell you that the whole world will be serverless then they're lying to you," warns Aniszczyk. "Businesses are always more complex than that."

Nevertheless, there are some steps that open source serverless platforms can take to maintain performance. Riff functions already stay in memory for a few seconds by default after executing to accept new requests by default, says Leschner, unlike AWS Lambda, which may or may not kick off an entirely new container.

Another option is to pool function-based containers, according to Leschner, so that there are always some "warm" container instances handy. That's something that Apache’s OpenWhisk and Platform9's Fission already do. It is part of the riff plan, but it isn't available at the time of writing, Leschner admits.

Early days

It's still very early days. So early, in fact, that the CNCF hasn't even adopted any of the native Kubernetes serverless open source projects officially yet, says Aniszczyk. That will probably happen towards the end of the year.

"What you'll see down the road is that there be a few that become dominant solutions in Kubernetes land. We don't need a dozen ways to do serverless on top of Kubernetes. A few will be good enough."

In the meantime, Aniszczyk hopes that large, hyperscale vendors will listen to their customers and open up their serverless platforms to be compatible with these open source offerings. After all, Amazon launched its Elastic Container Service for Kubernetes, didn’t it?

To help things along, CNCF is trying to standardize event calls with its Cloud Events initiative, which will enable standard event formatting to exchange event data between different platforms. Just don’t hold your breath for them to standardise the actual event types. That’s what would help to bridge the gap between something like Lambda and an open source alternative, but it’s a long way away.

In the mean time, companies will still opt for open-source serverless frameworks like riff in place of proprietary serverless offerings – according to 451 Research analyst Jay Lyman.

"For organisations that run a private cloud on OpenStack, it's pretty common to see that right alongside their Amazon, their Google, their Azure deployments," Lyman says. "There’s no reason to think that we won’t see the same thing in serverless."

Don't expect an entirely serverless world, and don't plan industrial-scale open source serverless roll outs for a while. As these initiatives mature, though, they will present another welcome alternative to Cloudzilla's gilded cage. ®

Serverless Computing London in November will give you the state of play on serverless and function as a service, and explain how to put them to work in your business. Full details, and ticket information, at the website here.

Similar topics

Other stories you might like

Biting the hand that feeds IT © 1998–2021