Introduction
The word serverless—it’s everywhere. In fact, according to Google trends, the word is Googled an average of 100 times daily in 2020. Is serverless just a buzzword? A facade? Or a world where we won’t need servers anymore?
Before completing my Cloud Developer Nanodegree program from Udacity, I too didn’t fully understand what serverless really meant. It was abstract, and most of the articles I read were filled with a lot of technical jargon that just didn’t make sense. I ended up concluding that serverless was just something the 10X developers came up with to remind us mere mortals of our status.
Luckily, I now know that is not the case. Here, I’ll explain in simple terms what Serverless (or Serverless Computing in full) means.
A Little Computing History
Development workflows have massively evolved over time. In the beginning, it was the era of traditional computing where physical servers and storage hardware had to be purchased, supplied with power 24/7, configured, and maintained by an organization’s operations/IT team for the purpose of deploying applications on them. These applications could either be an e-commerce or banking app with at least ten users making requests concurrently at every point.
In seasons when the usage of such applications spiked, such as Black Friday, the IT team had to either purchase more hardware resources, which would take a lot of time to process, or have existing pre-configured idle servers on standby to transfer requests to.
After that came the era of Cloud Computing and Infrastructure as a Service (IaaS). With IaaS, computing resources (servers, storage, networks, etc.) can be purchased instantly and managed over the Internet. This greatly reduced costs and eliminated the need for tedious hardware handling.
Although IaaS offered improvements compared to the traditional model, a couple of pain points still exist:
- Provisioned servers and other resources are paid for whether they are being used or not.
- Servers have to be scaled up when there is a surge in requests and scaled-down during peaceful times to avoid resource wastage and incurring charges.
- The responsibility of maintaining, updating, and securing the servers still fall on the developers.
For a small organization without a dedicated ops team or an individual developer, I’m sure that you can see how this would be a lot to handle. These tasks end up distracting and slowing down the development of the actual application. That is why serverless was introduced.
So What Exactly is Serverless?
Before you ask—no, serverless doesn’t mean that applications are now deployed without servers. Serverless is simply a development approach that allows you to focus on building your applications while the cloud provider takes care of provisioning, managing, maintaining, and auto-scaling servers that your applications will run on.
“Focus on building your application. Let someone else be your DevOps.”
A widely accepted technical definition of serverless is:
Serverless is an event-driven, ephemeral, and stateless cloud-based architecture that dynamically allocates machine resources.
Huh? What does that even mean?
In serverless, applications are architected following a modular microservice approach. Different services that make up the whole app are written and deployed as individual functions—hence the term Functions as a Service (FaaS). These functions will only be triggered and run in response to a specified event, such as a request to upload a file to a database. Just like you’ll only be matched with an Uber ride when you send a booking request by clicking a button.
When an event that triggers a function is received, the cloud provider automatically spins up a container alongside other resources in which the function is deployed and runs on. These containers are typically stateless in that they do not store any context from a previous execution of the function. They are also ephemeral, because once the function does its job, the container is typically destroyed almost immediately. It is safe to assume that for every request, a new container is spun-up.
In addition to using the FaaS approach, serverless applications also outsource much of the backend load to cloud-hosted managed backend services for features such as database management (Firebase, AWS DynamoDB), authentication (Auth0, AWS Cognito), and push notifications (Amazon SNS, Google’s FCM), enabling developers to focus on writing code that users will actually interact with and improve UX. This is known as Backend as a Service (BaaS).
Serverless = FaaS + BaaS
With serverless, all of the challenges that existed with the previous eras are taken care of.
- No more paying for idle time. You only pay when your functions are run in response to a request, which is more cost-effective.
- No more server management. No need to provision or install any software or runtime on servers; the cloud provider does that for you
- No more scalability issues. Function instances are automatically spun up as new requests are received.
- No more service downtime because of inbuilt high availability and fault tolerance.
Do you now see the benefits of serverless? It removes stress from our lives and lets us focus on the things that actually matter.
Originally published on TechWell Insights.