Serverless! What.. When.. Why ?

Deekshita Amaravadi
just2girlsintech
Published in
5 min readJun 3, 2020

I was talking to my Dad this past week about computing and how he used to help me understand computing concepts when I was 5 years old. Since then a lot has changed and going down that memory lane made me wonder what had changed since the 80’s and 90’s up-to now in the world of computing.

Serverless computing seems to be quite the buzz word in the tech community these days. Everyone regardless of whether or not they work in this industry are aware of some form of it.

Behold the Mighty Cloud …. Where all your important stuff exists

So how did we get here ?

The below is my attempt to get the history of computing consolidated and show how we came to the point of serverless.

SaaS: Software as a Service

Software as a Service is basically asking a 3rd party vendor to take care of your software needs without having to working about any stage of hosting, maintaining or deploying the app. Most often the web browser is used to operate the application.

Examples include: Salesforce, Dropbox, Google Docs.

IaaS: Infrastructure as a Service

Then came Infrastructure as a Service where there was a more agile and elastic fashion to how you managed the hardware and compute resources. It was an on-demand model which made it highly scalable and flexible without having to tie into the hardware costs upfront.

Examples include: Amazon Web Services (AWS), Microsoft Azure, Google Compute Engine (GCE), DigitalOcean, Linode, Rackspace.

PaaS: Platform as a Service

Now the same model was being explored on an application centric instance. PaaS provided a framework for developers to build on and create customized applications. The Platform itself will be managed by the 3rd party provider (servers, storage, network availability etc.) but the App management was in the hands of the developers.

Examples include: Google App Engine, AWS Elastic Beanstalk, OpenShift, Windows Azure, Heroku, Force.com, Apache Stratos.

CaaS: Container as a Service

With CaaS everything became much more smart and the underlying behind the application and the management was much more robust and easier to maintain. You could have multiple containers with totally different tech stacks on them and they could be running as isolated silos on the same machine you had without having to do the abstraction part yourself. This made things so much more standardized from code to test all the way to deploy phasse.

Examples include: Azure Kubernetes Service from Microsoft or Elastic Container Service from Amazon.

Ahhh….. drum roll ….. and finally

FaaS: Function as a Service

Around the 2014-present era we have seen a shift in the “as a service” model to be down to Pay per Use Code Execution. This means we only need to pay when something is running and can scale up or down based on the usage for that code function.

Examples include: Amazon Lambda, Google Cloud Functions, Microsoft Azure Functions, IBM Cloud Functions.

What is Serverless Computing ?

According to Wikipedia

Serverless computing is a cloud computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity.It can be a form of utility computing.

Serverless computing can simplify the process of deploying code into production. Scaling, capacity planning and maintenance operations may be hidden from the developer or operator. Serverless code can be used in conjunction with code deployed in traditional styles, such as microservices. Alternatively, applications can be written to be purely serverless and use no provisioned servers at all.

This should not be confused with computing or networking models that do not require an actual server to function, such as peer-to-peer (P2P).

Source: https://www.gocd.org/2017/06/26/serverless-architecture-continuous-delivery/

Example of Serverless Architechture

There is a very clear example for this explained by Mike Roberts in the post here I highly recommend read.

For our example we have an events application where we can see the events we are interested in and purchase the ones we want.

Authentication service could be a 3rd party Backend as a Service (BaaS)

Example: Auth0

For storing data of the Event Listing itself we could use another BaaS which will take care of the security and the servicing for the Database.

Example: Google Firebase, Amazon DynamoDB

The search functionality can be a FaaS function where a HTTP request to it will give a listing of all the Events with the search keyword.

Similarly the Purchase functionality can be another FaaS that takes care of the security and the purchase history for the user.

This way we abstracted and divided what we wanted into logical components that could be reused later if we did decide to scale the application to more than just serving event listings.

For Example the search function could be used for any generic search needed on multiple projects across the enterprise.

Best Use Cases for Serverless

Web Applications mostly 3 tier

Photo by Hal Gatewood on Unsplash

APIs (Application programming interface)

Photo by Markus Spiske on Unsplash

Any sort of Steam processing

Photo by freestocks on Unsplash

Big Data and building pipelines and what not :)

Photo by Luke Chesser on Unsplash

Batch processing

Automation of Infrastructure

Source: http://www.nexiilabs.com/it-infrastructure-automation.html

Closing Words

There are many things that serverless can provide and it can be very powerful if implemented with the right architecture mindset.

Things TO DO with Serverless

  1. Write code in logical units
  2. Make sure to define triggers
  3. Connect the managed services together
  4. Pay for consumption

Thing NOT TO DO with serverless

  1. Try to meddle with provision of the infrastructure
  2. Make any patches to the infrastructure
  3. Make custom scaling rules and policies
  4. Store the state along with the function

I will be covering another post for the types of cloud providers FaaS that exist and a more indepth view for best practices around the serverless architecture. Till then I hope this post keeps you informed and entertained. Stay safe and don’t BS just follow DS :).

--

--

Deekshita Amaravadi
just2girlsintech

Software Engineer. Changing the world,one code line at a time. Passionate about engineering, socializing change, human rights and equality, yoga and reading.