Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Short Introduction to Serverless Architecture

DZone's Guide to

A Short Introduction to Serverless Architecture

Now that serverless has been out for a while, let's see what it is, what it isn't, and where it would fit well in your application.

· Cloud Zone
Free Resource

Linkerd, the open source service mesh for cloud native applications. Get the complete guide to using Linkerd and Kubernetes to build scalable, resilient applications.

Evolution of the Cloud

During its evolution, the cloud has had multiple forms and abstraction levels.

Evolution of cloud

The data center, be it on-premises or provided by a vendor as a service, was the first step to the cloud as we know it today. It abstracted the physical hosting environment, and we started scaling those environments with hardware units. As virtualization evolved, we started hosting virtual machines on cloud environments. We abstracted the hardware and used operating systems as the unit of scale. Soon after this, we built hosting environments to the cloud and abstracted the operation system. Our new scaling unit was the application. But this was not the end of the journey, as now we've moved to functions or serverless architecture.

Different cloud models leave us different responsibilities. Having the data center on-premises means that we have full responsibility over everything that is going on there. When moving to the cloud, each step in the evolution leaves us fewer and fewer responsibilities.

Cloud models

Serverless architecture actually came later than SaaS, but it is before SaaS in the chart because in the case of SaaS, consumers don’t control anything about the application or its infrastructure.

Serverless Architecture

Functions are the unit of scale in serverless architecture that abstract the language runtime. We don’t talk about how much CPU or RAM or any other resource we need for a function to run. We talk just about the time it takes to run the function. All other metrics should not bother us. We write our functions, publish them to the cloud, and pay only for time these functions ran.

Serverless architecture doesn’t strictly specify what our function technically must be. It is just some unit of work that we want to be done. Functions can be triggered many ways. It can be a timer that runs a function periodically, but it can also be HTTP request or some event in some related service.

In his excellent article Serverless Architectures, Mike Roberts brings out six points about Functions-as-a-Service:

  1. Fundamentally, FaaS is about running back-end code without managing your own server systems or your own server applications.
  2. FaaS offerings do not require coding to a specific framework or library. FaaS functions are regular applications when it comes to language and environment.
  3. Since we have no server applications to run, deployment is very different from traditional systems – we upload the code to the FaaS provider, and it does everything else.
  4. Horizontal scaling is completely automatic, elastic, and managed by the provider.
  5. Functions in FaaS are triggered by event types defined by the provider.
  6. Most providers also allow functions to be triggered as a response to inbound HTTP requests, typically in some kind of API gateway.

Adrian Cockroft defines “serverless” clearly in his tweet:

If your PaaS can efficiently start instances in 20ms that run for half a second, then call it serverless.

From this, we can conclude that long-running workflows and other massive tasks are not a good fit for serverless architecture.

Functions Services

There are already companies that run functions as a service. Here are some of these:

There are many other services available, and all of these differ by their technical capabilities and implementations.

Wrapping Up

Serverless architecture allows us to build pieces of code that do something useful, and at the same time, run quickly without consuming big amounts of server resources. It doesn’t mean that FaaS is usable only in small scenarios. Although a function is a small unit, it can be invoked millions of times per second, for example. The question is what small functionalities we should move from other components or layers of our application to functions.

Linkerd, the open source service mesh for cloud native applications. Get the complete guide to using Linkerd and Kubernetes to build scalable, resilient applications.

Topics:
serverless architecture ,cloud ,cloud infrastructure ,faas ,tutorial

Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}