Serverless architecture: discover computing without… computers?

HP storage server macro

Cloud computing revolutionized the whole data-center IT stack, even more so, containers that broadened the already vast amount of technologies. But there is one technology, or rather, architecture that is bound to change the game again: the so-called serverless architecture. Let’s take a look at what is it and how can you implement it today.

Serverless: applications without servers?

Before jumping into the architecture it’s best to define what we’re currently usisng today. Today one of the most important and widely-used models, architectures, is the client-server model. In this model there is a central service provider (the server) and many consumer of that service (the clients).

When the model was formulated, no one would’ve imagined the number of clients would have been growing so much to the point of saturating the (central) server capabilities. So a new problem was born: “How do we scale past the physical boundaries of the server?”. In the early days the only solution was vertical scaling (read: add more CPUs, RAMs, storage to the server), but technology can grow up to a point. That’s when horizontal-scaling and clustering came to be: multiple servers working on the same workload. Then came virtualization, cloud, containers etc.

Returning to the original topic: what is serverless? If we center our services around servers, we can’t possibly remove them from our models. Just like cloud is said to be “Just someone else’s computer“, you could define serverless as “Just someone else’s environment” (or server).

In the serverless architecture, a specific program doesn’t need a “server” to run, the program is instead run on a rented, third-party, service that takes care of its execution. Instead of paying for physical resources as in the IaaS cloud model, you pay for code execution. When the program exits, you stop paying.

Serverless: (M)BaaS and FaaS, is it just another cloud?

Serverless isn’t THAT new; as a matter of fact it is just another term to point (for most of the part) to the following cloud models:

  • (Mobile) Backend as a Service: the (M)BaaS model wasn’t as successful as others cloud models and chances are you have never heard of it. BaaS alone is almost nowhere to be seen, most BaaS are Mobile BaaS since the Mobile world is the main consumer of this model; the only difference between BaaS and MBaaS is the consumer.
    MBaaS offerings include hosted platforms and integrated SDKs that back an actual application, in this model you pay for the resources used by the application and for the platform tools provided by the offering. Generally, MBaaS offerings will be pretty different from each other since there is no standard.
  • Function as a Service: the new kid in town. This is the closest model to the meaning of “serverless”. In FaaS you upload programs (called functions) to third party services and pay for their execution only. Typically you will have hooks that trigger the execution of that code defined through the platform that hosts your functions.
Example
Imagine you want to execute some heavy piece of code every time a visitor come to your site, instead of using some server code such as a PHP script, you can upload that script to a third-party environment and hook it to your website. The heavy lifting is then offloaded to the third-party, you still get your code executed but your visitor isn’t slowed down by the execution of that code.

Serverless: advantages and drawbacks

The Serverless architecture has two main advantages:

  • Reduce Ops costs and complexity: managing server, scaling, containers and all those complicated sysadmin-ish stuff is complex. With serverless, developers develop their applications against a common backend without the need to fiddle with servers, scaling, monitoring and all traditional IT operations.
  • Increase efficiency: small portions of code (functions) can be run millions of times and since they only run for a usually small, determined, time there is no need for an always-up server to serve the request.

On the other hand the Serverless architecture poses many obstacles and has a few drawbacks:

  • Complexity: although there are no servers, scaling or monitoring, a function is a small, tiny amount of code. All these functions need to be orchestrated by a developer and that soon becomes daunting, increasing the service complexity. The complexity removed from server management becomes complexity of functions management.
  • Difficult debugging: seasoned developers may have to struggle less, but debugging distributed systems is a difficult task already. Imagine debugging hundreds of tiny functions that are connected.
  • Vendor lock-in: developing against a third-party API avoids all the server management, but effectively locks the resulting software to a specific platform.

The main offerings: how can you use serverless (FaaS) today?

Today most serverless operations are monopolized by big cloud competitors, here’s a list of the most prominent FaaS offerings:

  • AWS Lambda: probably the number one offering, backed by Amazon. AWS Lambda currently supports Java, Node.js, C# and Python but other languages may be supported in the future. In the meanwhile third-party libraries are available to support other languages such as PHP and Ruby on AWS Lambda.
  • Google App Engine and Google Cloud Functions: both services are provided by Google, Cloud Functions only supports Node.Js while App Engine supports a variety of languages. App Engine is the oldest entry in this category, released in 2008 it only supported Python with a custom framework.
  • Azure Functions: the service, offered by Microsoft, is part of the Microsoft Azure platform, its focus is event processing.
  • IBM Cloud Functions: this service is backed by IBM and part of IBM Cloud, it supports many languages including Java, Python and Node.js. Interestingly this solution is based on Apache OpenWhisk (more in a while).

MBaaS offerings: don’t go too FaaS!

Although FaaS is great for simple and standalone code, sometimes you may need a larger backend and here’s where MBaaS comes in. Here’s a list of the most prominent MBaaS offerings:

  • (Google) Firebase: Firebase is, hands-down, the most complete and feature-rich MBaaS on this list. Firebase has put great effort and focus in real-time applications, with its database boasting latencies in the milliseconds.
  • AWS Mobile Services: the second in the list is the offering from Amazon, the product offers basic MBaaS features, mostly: authentication, storage, push notifications and database. Its strong point is the tight integration with other AWS services.
  • Azure Mobile Apps: the offering by Microsoft closely resembles the one from AWS. The product focuses on SSO and AD integration.
  • Red Hat Mobile Application Platform: last in our list is Red Hat offering, the platform offers most of the features offered by other competitors. The strong point about RHMAP is the integration with its powerful PaaS: OpenShift and thanks to that the integration with CI/CD pipelines based on Kubernetes and other open source software. This entry is backed by an open source project, more in the next paragraph!

FaaS and MBaaS Open Source projects – Avoiding vendor lock-in

Both FaaS and MBaaS have their own advantages and disadvantages, and work pretty well together, but sooner or later you’ll notice that you’re building on a proprietary platform and you’re effectively being locked in. Although offering such AWS Lambda or Firebase are pretty unique and their features can hardly be replicated, here’s a list of Open Source projects (both FaaS and MBaaS) that might come in handy:

  • Parse: Parse was a company up until 2013 when Facebook acquired it. In 2017 Facebook decided to shutdown Parse, the Parse server was open sourced and still lives on. Parse is often regarded as the most mature platform (MBaaS) and the real Open Source alternative to commercial platforms.
  • Apache OpenWhisk: the OpenWhisk project is a FaaS software that aims to be an Open Source platform for event handling at any scale. The project is backed by IBM which uses it for its IBM Cloud Functions aforementioned. Lately Red Hat has taken interest in the project and is currently working to integrate it in OpenShift.
  • OpenFaaS: a FaaS implementation that leverages Docker and Kubernetes.
  • Fission: Fission is an open source FaaS implementation based on Kubernetes and backed by Platform9, a popular cloud services provider.
  • Serverless (framework): is a vendor-agnostic framework to develop functions that can work on FaaS backends. Serverless currently supports AWS, Azure, Google Cloud Functions and Apache OpenWhisk.
  • FeedHenry: a full MBaaS solution backed by Red Hat, it is the upstream version of Red Hat Mobile Application platform. FeedHenry features an all-in-one environment for development and it is tightly integrated with OpenShift.
  • BaasBox: a standalone BaaS implementation, completely Open Source and backed by the homonym company.
Image courtesy of Martin Abegglen
mark

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.