Hackernoon logoYour Serverless Guide is Ready by@PavanBelagatti

Your Serverless Guide is Ready

According to 2019 Forrester report, 49% of companies are using or planning to use serverless architecture in the next 12 months. Serverless is not fewer servers or no servers; it does not relate to or involve running code without servers. The main selling point of serverless is ‘focus on what matters’.Serverless is event-driven, reacting only when something happens. It is not just about containers and Lambdas; package managers like Artifactory play a vital part here as well.
image
Pavan Belagatti Hacker Noon profile picture

@PavanBelagattiPavan Belagatti

DevOps Influencer

Introduction

With the increasing popularity and adoption of services like AWS Lambda and Fargate, serverless technologies are gaining more attention in every company's technology stack. Serverless adoption has become a boon and desirable option to meet DevOps firms' unique needs. Serverless technology helps companies scale their cloud-based architecture. According to the 2019 Forrester report, 49% of companies are using or planning to use serverless architecture in the next 12 months.

How Did We Get Here to Serverless?

image

Source credits: The TechCave

Not so long ago, companies and individuals used to buy and manage their own software and hardware, from networking infrastructure to data stores to servers to high-level responsibilities hiring specialized teams and individuals for each responsibility. It was a kind of 'do it all yourself' (DIAY) type of approach. 

Then companies started outsourcing some responsibilities. Then the cloud came, with the combination of virtualization, which laid the groundwork for Infrastructure as a Service (IaaS), and Platform as a Service (PaaS). These technologies and trends allowed for more outsourcing and, as a result, more focus on the business logic. Hence the software lead time, delivery of new features became relatively easier. Then came the containerization wave, and new services emerged as Container as a Service (CaaS).

Serverless was a step forward in this software movement or revolution. 

As the advancements happened over time, the goal was always to remove developers' pain and burden while creating software. However, there was still this server-side logic, code, and functionalities that were still a headache. That is when the Serverless trend was introduced, and with this, the server-side headaches have somewhat disappeared as this technology takes care of all the server-side logic and helps companies focus more on the business-side logic. 

What is Serverless Anyway?

Serverless is not fewer servers or no servers; it does not relate to or involve running code without servers. It is called “serverless” because the firm or an individual that owns the system does not have to purchase, rent, or provision servers or virtual machines for the back-end code to run on. The main selling point of serverless is ‘focus on what matters’. 

Serverless is event-driven, reacting only when something happens. 

For example, do you use Alexa in your house? Then you are using a serverless system. 

When you talk to Alexa, that triggers the voice command, and then it sends that information to make that request you asked for. When you say 'Hey Alexa, turn the lights on', it is serverless working for you.

image

Source credits: GOTO 2020

Serverless is an operational construct

image

Source credits: Kesley Hightower

Serverless is generally built on four principles:

  1. No servers to maintain or manage
  2. Automatically scale with usage
  3. Pay for value, not for server units
  4. Availability and fault tolerance built-in

As you think about moving to serverless, it is not just about containers and Lambdas; package managers like Artifactory play a vital part here as well.

Let's say we are using a project called OpenFaaS, which is serverless based on Kubernetes. At some point here, one of the things we would love to do is get the dependencies; that is where Artifactory comes into play. Even though we are deploying to a serverless platform, everything is powered by Artifactory. That means you know exactly what version, which licenses, and know exactly what goes on in your Docker containers. As you look at your build info at Artifactory, you will know exactly what was built and all other info that you require as a developer.

image

So, as a developer caring about serverless technology, you still need to know what you are using, the dependencies, what the licenses are, etc., because, at the end of the day, it is the developers' responsibility to do the right thing when it comes to licenses and many compliance tasks.

Why is Serverless Required?

Traditional architectures have these two main problems:

1. Single point of failure:

If a server crashes for whatever reason, the whole website will crash and become unavailable for the customers, negatively impacting the business. To make matters worse, if a production database is run on the same server as their website, the server crashing will affect all connections to the database as well!

2. Continuously on:

“Always on” translates to continuous paying. Always paying for the server usage no matter how many users are on the website will not help many businesses as they are still growing and creates unnecessary overhead costs. 

Serverless is an ongoing movement/trend that highlights and focuses from a developers’ perspective of writing better code and more rich features than focusing on the maintenance of the environments.

image

Image credits: JAM

How Does Serverless Work?

All you need to do is upload your code to a cloud provider’s service, and they automatically provide an ephemeral environment. Unlike traditional architectures, it can scale up to handle thousands of requests in an instant, and you only pay for the duration during which your code executes.

From the developer's viewpoint, with serverless computing, the need to maintain physical infrastructure and systems software goes away. Serverless architectures are well reliable, highly scalable, and deliver high performance. Serverless computing lets you pay only for the resources your application consumes on the go. You can easily monitor and validate the linear relationship between your code's efficiency and what it costs to run it. The faster your code and systems run, the less you pay. 

We all have seen how SREs and DevOps engineers used to run their applications on servers that demanded thorough and continuous monitoring, including late nights, weekends, and early mornings due to the unimaginable errors, nightmares, and production issues that could happen. Before, the whole responsibility of maintaining, updating, and monitoring the servers was on us. But with serverless, the aim is to no longer have to worry about the management of servers as the responsibility falls under the hood of cloud vendors. 

Here’s what a serverless architecture looks like:

image

Image source: Sumo Logic

Here are some of the available serverless cloud services:

Two main types of serverless architectures

FaaS (Function as a Service): FaaS refers to stateless functions that contain server-side business logic and are run in independent containers, and these are event-triggered.

BaaS (Backend as a Service): This refers to using third-party services to accomplish the means, examples like firebase and Auth0. In BaaS, the client handles most business logic with external services like authentication, database, user management, etc.

In traditional architecture, all the business logic will be sitting on one big monolithic server. In serverless, the monolithic application will be broken down into multiple server components as FaaS and this example illustrates the thought process behind using serverless along with microservices. 

Serverless and Containers: Are They the Same?

Both containers and serverless have modernized the way we develop and ship software. These technologies are seen as developers' best friend as they allow them to focus on their code & creativity rather than wasting time on infrastructure. As developers get busy in coding and developing new features, it increases development speed. Both containers and serverless are perfectly fit for microservices and component-based architectures. With both containers and serverless employment within our tech stack, development, deployment, and scaling become faster and more cost-effective than classic monolithic architecture. 

Despite such commonalities between containers and serverless, both differ in their advantages, disadvantages, and use cases.

Would you like to explore more about Serverless?

Download the full free serverless guide today!

Also published at https://dzone.com/articles/serverless-guide-for-everyone

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.