An Intro to Serverless Architecture

Viraj Shah
5 min readMar 21, 2018

Building a Scalable Backend

The evolution of serverless

What if I told you that you can deploy server side code without having to maintain any infrastructure?

Sounds pretty good right? Well that’s what serverless architecture is all about.

What is serverless?

Despite the name, it does not actually involve running code without servers. The name “serverless computing” is used because you do not have to purchase, rent or provision servers or virtual machines for your backend code to run on.

Sorry to burst your bubble, but there is no cloud. Photo by Chris Watterson

Serverless allows developers to build and run applications and services without thinking about the servers actually running the code.

Comprised of two main components:

  • Functions as a Service (Faas)
  • Backend as a Service (Baas)

Functions as a Service

FaaS is the concept of serverless computing via serverless architectures. Software developers can leverage this to deploy an individual “function”, action, or piece of business logic. They are expected to start within milliseconds and process individual requests and then the process ends.

At the basic level, you could describe them as a way to run some code when a “thing” happens. FaaS comprise of three main concepts.

Fully-managed compute

Provisioning, patching, scaling, monitoring, and logging are provided out-of-the-box! #lessops

Easy Code Deployment

Just package and upload your code. #savetime

Pay for what you use

Get billed based on usage per 100ms. #savemoney

Backend as a Service

What is a Backend as a Service anyways?

Is an approach to cloud computing that provides a backend for applications. They provide an API and tools for different computer languages to integrate with their backend. They also provide additional services like storage, Analytics, Push notifications, dashboards, social integration.

BaaS is your database simplified.

Combine fast and predictable performance with seamless scalability while also offloading the administrative burdens of operating and scaling distributed databases.

Which means…

You as a developer don’t have to worry about:

•Hardware provisioning

•Setup and configuration

•Throughput capacity planning

•Cluster scaling

•Software patching

Service Providers

Tech giants, Amazon, Google, and Microsoft, have all adopted serverless computing into their suite of web services for a while now. Each platform has its own quirks, but they are fundamentally all the same.

Just so many options to choose from! What’s your favorite?

Triggering your functions

So you must be thinking, “That sounds great and all, but how does serverless actually work?” It’s pretty simple really. Once your code is deployed, all that is left is to define event triggers to call your functions. These events include but are not limited to:

HTTP Requests

•Storage (File uploads)

•DB Triggers

•Event Streams

•Queue/Messaging

It’s just that simple.

So now you know a little bit about how serverless architecture works, but how do you get started?

Enter AWS Lambda and DynamoDB

Lambda is positioned at the heart of AWS’s offering, acting in some ways as a gateway to almost every other cloud service it provides.

Horizontal scaling is completely automatic, elastic, and managed by the provider. If your system needs to be processing 100 requests in parallel the provider will handle that without any extra configuration on your part.

Lambda serves as the Faas while DynamoDb serves as the BaaS

Lambda can also act as the full backend service of a web, mobile, or IoT application — receiving requests from the client through the Amazon gateway, which converts these requests into API calls that are later translated to predefined triggers running specific functions.

The last puzzle piece

Using FaaS alone is not enough to deliver any real-world architectures in the cloud. Even the most basic applications will require at least some means of exposing the functionality to the end user. This can be accomplished with another AWS offering, API Gateway.

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.

You can create an API that acts as a “front door” for applications to access data, business logic, or functionality from your back-end services from Lambda.

In Conclusion

Serverless computing is a powerful and robust paradigm that is different from both the traditional monolithic and microservice architectures. Leveraging serverless architecture, developers are able to create systems that are fault-tolerant, resilient, and highly scalable.

We are forever going to be building more and more complex systems that solve new problems in ways we could never have dreamt of 20–30 years ago. With these new architecture styles, we can approach problems in ways that would never have been thought possible way-back-when.

While still in its infancy, serverless computing is not meant to wholesale replace the current software development architectures. However, by recognizing the right uses cases, this new architecture pattern can greatly simplify a developer’s workflow.

Hopefully you found this article informative! I’m always eager to hear your feedback and experience with serverless so please feel free to leave a comment in the comments section below!

For more content like this, visit my website: youngvz.io

--

--

Viraj Shah

Hey! I am software engineer with a passion for all things mobile and the cloud. Let’s talk technology.