Why should you consider a serverless architecture for your next project?

serverless architectures have turned the way business build their backend infrastructure

Can a serverless architecture offer feasible benefits for your product? You’re probably asking yourself this question right now, given all the buzz surrounding AWS Lambda, Azure Functions, and similar services. So what exactly will you gain from moving your server-side logic to the cloud?

Let’s explore the state of the serverless technology in 2017 to help you find the right answer to this question. Read on for an overview of serverless architectures and their pros and cons. We’ll also look at major serverless service providers of 2017 and the examples of brands like Netflix, Airbnb, and Nike adopting the technology.
 

What is serverless — and what is not?

According to Mike Roberts and his definitive article on MartinFowler.com, the name serverless describes two types of application architecture.

  1. Backend as a Service or BaaS, an architecture where most of the application backend is on the cloud, maintained by a third party. It’s more typical for a serverless backend of this type to power client-heavy architectures, like mobile apps or web applications with a rich UI.
  2. Function as a Service or FaaS, where applications run parts of their server-side code in event-triggered ephemeral containers. The functionality you get with FaaS is more general-purpose in nature because we’re essentially talking about evoking separate serverless functions on demand.

 

As far as FaaS and BaaS go, there’s an important distinction to consider. While FaaS provides more flexibility, it’s not uncommon for BaaS platforms to cater to specific use cases or prioritize specific functionality. With AWS, for instance, you get BaaS platforms that target API development and maintenance, management of sign-ups and sign-ins, etc.

Most industry leaders offer both BaaS and FaaS models. Google’s serverless service Firebase, for instance, is BaaS while Google Cloud Functions is FaaS. This said, FaaS is newer, more popular, and, technically, it’s FaaS that most people mean when they mention the term serverless.

So even though serverless architectures refer to both BaaS and FaaS, this post will mostly focus on FaaS.

What serverless is not

There is a blurred line between serverless and conceptually similar cloud services. Technologies like PaaS, containers, “No Ops”, and SPaaS allow you to “move the server to the cloud”, just like serverless. Still, there are important differences in what serverless and each of these technologies can offer.

  • FaaS versus Platform as a Service (PaaS). A major advantage of FaaS over PaaS is the granular control over the process of scaling your application. FaaS is also optimized for evoking an entire serverless application for every request, while PaaS isn’t.
  • FaaS versus containers (CaaS). Again, with FaaS you get granular automatic scaling of applications which isn’t a strength of CaaS — just yet. The good news is Kubernets seems to be catching up the scalability department, so we’ll probably see this gap close in the future.
  • FaaS versus “No Ops”. Serverless web applications and mobile apps that rely on FaaS still make you handle monitoring, deployment, security, and networking. Whereas “No Ops” implies automating the sysadmin role, serverless makes you outsource it.
  • Serverless versus Stored Procedures as a Service (SpaaS). Stored procedures services often enforce vendor-specific languages or frameworks. In addition, the nature of SPaaS platforms hinders testing and version control. Serverless architectures have no such limitations.

 
 

Examples of big brands embracing serverless architectures

Serverless computing allows companies to streamline infrastructure administration, fueling the digital transformation of businesses. What’s more, there are multiple examples of tech giants and multinational corporations using the serverless to gain an edge over their competition. Read on for a high-level overview of four test cases of this kind.
logos of brands using serverless architectures: Coca-Cola, BBC, Netflix, and Airbnb

The Serverless framework helped Coca-cola reduce costs

A multinational brand with hundreds of web and mobile applications, Coca-Cola spends a fortune on the maintenance of its server infrastructure. Integration of the Serverless framework and AWS Lambda into the company’s process helped the company reduce these costs.

In a case study mentioned by the Coca-Cola’s Michael Connor, Lambda substituted six T2 Medium servers with an EC2 / AWS Elastic Beanstalk combo. The move reduced the cost of handling ~360 million yearly requests from $12,864 to $4,490.

BBC declutters its mobile development processes with serverless

AWS Lambda (FaaS) and AWS API Gateway (BaaS) are the two serverless computing platforms that underlie Bitesize, a mobile app from BBC. The use of AWS tools is a part of the company-wide shift towards the decluttering of development and infrastructure management.

Netflix streamlined its server infrastructure with AWS Lambda

Netflix was one the first video content providers to start managing its server infrastructure via the AWS APIs. In 2015, the company’s engineers implemented a solution based on AWS Lambda for a system that introduced a higher level of abstraction to infrastructure management.

This solution substituted the obsolete procedural layer with an efficient rules-based system which improved security, backups management, and operational monitoring.

Airbnb designed its own AWS-based serverless framework

Airbnb’s homegrown serverless computing framework StreamAlert powers the real-time analysis of data collected by the company. Based on AWS Lambda and a number of other AWS services, StreamAlert prioritizes scalability (from MB ro TB/hour) and openness. The framework is open source and environment-agnostic, and it supports major data types including JSON, Key-Value, CSV, and Syslog.
 

Why serverless? Key pros and cons to consider

The case studies of big brands prove that going serverless can help you streamline quite a few things. There’s an obvious tradeoff is having to rely on a third-party vendors, but the game’s still worth the candle, right? Actually, there are many pros and cons that can become important decision factors.
the pros and cons of serverless architectures

The strengths of serverless architectures

The single major advantage of going serverless is the improved efficiency that manifests itself across every key aspect of software development.

  • Faster releases and reduced time-to-market. Going serverless can reduce your time to market by up to two thirds according to a case study from Microsoft. While we’re talking about a specific case here, faster release cycles are something you can generally count on with serverless.
  • Reduced operational cost with simpler operational management due to the fact that you outsource large parts of these processes.
  • Reduced development cost with no need to handle updates or infrastructure maintenance. As far as real-world examples go, transition to serverless computing platforms can reduce your development effort by as much as 36%.
  • Reduced cost-to-scale. Thanks to automatic scaling, going serverless helps you eliminate a huge chunk of developer workload and maintenance effort.
  • Agile-friendly development. Both BaaS and FaaS platforms let developers focus on building features rather than maintaining infrastructure. Another benefit that serverless offers in this respect is the reduction of the complexity of software.
  • Serverless is compatible with microservices which you can implemented as FaaS functions.
  • Eco-friendly computing. This might seem like a minor advantage, but some companies will appreciate the opportunity decreasing their energy consumption footprint. According to Mike Roberts and Forbes, a typical server operates at ~15% of its computing capacity while it still consumes a lot of power. Thanks to higher load, the servers at AWS or Azure are more energy efficient.

 

The weak points of serverless architectures

In software development, nothing is perfect, and no architecture is a one-size-fits-all solution. Serverless is no exception to this rule. For this reason, it’s worthwhile to consider the main drawbacks of serverless architectures.

  • Less control due to vendor lock-in. While not necessarily a disadvantage, some people (and some companies) need 100% control over their operations. For obvious reasons, this is not an option with serverless.
  • Learning curve. Based on what our clients tell us, getting used to working with FaaS functions requires some time. At the end of the day, though, things tend to become much simpler.
  • Integration testing is more challenging. As of 2017, serverless vendors do not provide you with out-of-the-box tools for local testing. You have to use your regular production implementation, deploy remotely, and work with remote systems for integration and acceptance tests. This changes how testing automation works in most teams.
  • Additional overhead for function/microservice calls. There’s no guarantee (or reason to assume) that two interdependent FaaS functions are running on the same server. Knowing this, you will need to adjust your code accordingly.
  • The “Cold Start” problem for JVM-implemented functions. It may occasionally take AWS Lambda up to 10 full seconds to run the first call for a JVM-implemented function. Again, we’re talking about something rare — and something that’s going to be fixed in the future.
  • Vendor differences. In particular the implementations for logging FaaS functions differs across implementations.

 
In addition to the cons outlined above, there are several concerns that deserve a separate mention. The points outlined below describe low-probability scenarios that are unlikely to cause real-life problems. Still, you can often hear people bring up these points when talking about serverless architectures.

  • Multitenancy concerns. In the situation where your and someone else’s serverless applications run on the same physical server, various problems may occur. Though the probability of critical issues is extremely low, it’s easy to picture several unpleasant scenarios:
    • one client sees fragments of other client’s data due to bug on the vendor side;
    • your application fails because someone else’s application causes a server error;
    • your application is slow because the server is busy crunching data for some else’s app.
  • Security concerns. Working with serverless vendors increases your surface area for cyber attacks. This said, hardly anyone can compete with Amazon, Microsoft, IBM, and Google when server security is concerned.

 

Top serverless platforms of 2017

If the pros of serverless outweigh the cons for you, what platform and vendor will you choose? AWS Lambda has certainly gained a lot of traction, but there are other top-tier vendors out there. The table provides a brief comparison of the three major players in the FaaS league.

AWS Lambda Azure Functions Cloud Functions
Vendor Amazon Microsoft Google
Supported languages Node.js (JavaScript), Python, Java (including Java 8), C# (.NET Core) Recommended: C#, F#, Javascript;

Supported: TypeScript, Java, Python, PHP, Batch, RowerShell

JavaScript
Max execution time (seconds) 300 300 540
Max number of functions per project unlimited unlimited 1000
HTTP/HTTPS invocation API Gateway, AWS Services HTTP triggers, Microsoft cloud services HTTP triggers, Google Cloud Pub/Sub, Google Cloud Storage
Deployment Zip Web Editor Zip and Google Repositories
Monitoring Amazon CloudWatch Logs, X-Ray Azure Application Insights StackDriver
# of free requests during trial period 1 million 1 million 1 million
Price per 1 million invocations ($) 0.2 + 0.00001667/GB-second 0.2 + 0.00001667/GB-second 0.4 + 0.00000231/GB-second

 

Bottom line: the world is ready for serverless. Are you?

While serverless has its cons, the technology is more than ready for professional software development. With big brands on both the demand and the supply side, serverless architectures will become more common in 2018, turning dedicated servers into “the old way of doing things”.

 

Looking for Serverless developers?

Our software engineers have years of experience with Node, C#, and Java. We’ve have over 15 years of experience building top-notch software for world-class brands, and we know how to turn your ideas into an awesome project.