Gentle introduction to Serverless Computing

Madhusudhan Konda
8 min readFeb 19, 2019
Serverless computing is gearing up. It will be the future

In the last few years, businesses using Serverless compute models have grown rapidly, use cases have increased exponentially, startups have embraced with so much love, software development community exploring the architectures with great interest and cloud providers are investing heavily in the product offerings.

This is an article on Serverless Computing in general (stay tuned for a further set of articles with a detailed developer insights into two offerings: AWS Lambda and Google Cloud Functions)

In this article, we will understand the evolution of Serverless computing from a very high level.

On-Premises Model

Software development doesn’t run in vacuum. It needs Hardware. Solid Metal. Servers. Racks and racks of them, along with network switches, load balancers, routers and others. In addition to this, it needs software. Like operating systems and firmwares and application binaries as well as databases.

This is On-premises or Traditional computing model.

Ouch! Server Hardware is Expensive

Procuring servers and hardware is a costly affair!

Any organisation certainly need to worry about infrastructure, even if their primary business in not IT! Whenever they wish to build a product, in addition to design and development, managers need to procure the required infrastructure. And, hardware is not cheap.

And estimating the right amount of memory or hard disk space for each server is more likely a guess work as today’s application requirements will definitely change in a year or two.

If the application is serving global customers, we need to build redundancy.

The hardware setup doesn’t stop with setting up production gear! There’s development, UAT, system testing and disaster recovery and others!

I have seen in few of the projects that I’ve worked on, this task of procuring servers may take anything up to five or six months!

And, to top it all, these servers require constant maintenance, security patches, upgrades and what not!

Believe it or not, there’s usually a whole fleet of support and operations teams in many organisations working throughout managing and maintaining these hardwares. Organisations have to shell out humongous yearly budgets on these activities.

Worse is, they are not IT companies — why would a Fashion Business, a Hedge Fund, an Online Grocery or an University need to invest heavily in IT year on year when their actual business has nothing to do with this extra baggage?

Most servers are under utilised. Sure there must be of many of these servers sitting idle and not doing any work at all!

Employing DevOps teams for managing and maintaining these fragile infrastructure is not an easy task for any organisation. Having such infrastructure is more likely than not a burden on the organisation.

I don’t want to crash! Will you scale me?

And don’t even go near to scalability or reliability of applications. It is quite difficult to get this ratio correct when serving the high demands! You may remember few years back few of the popular websites crashed — they couldn’t handle the exponential load during Christmas sales!

Scalability and high availability are mandatory attributes in this day and age of computing!

Getting the application ready for the sudden spike of unexpected demand is like playing with devil. Unless you pour money into organisational data centres, it is hard to get the balance scaling to the demands.

Does it resemble building a new house?

Let’s build a brand new house, Baby!

Take an example of building a new house. We have land, now we need to build a house.

As we are building a brand new house by ourselves, we need to sort a lot things — the planning and all required permissions, supplies, steel and others including architect’s designs. This process might not be a straightforward as it would take time, money (and sometimes may lead into disastrous outcomes).

Grr.. it is indeed a lot hard work than I thought..

Can you just let me code, please?

Wouldn’t it be nice if the development team concentrate only on development of feature required for the product or customer?

Wouldn’t it be nice if they are less distracted with all the noise related to, say, hardware?

Welcome to IaaS — Infrastructure-as-a-Service

And that’s exactly when cloud providers came up with a revolutionised idea of Infrastructure-as-a-service (IaaS).

They created huge data centres with thousands of computers ready to be provisioned with a click of a mouse! We didn’t need to buy our servers any more. Just few clicks would create a server of any size or specification in couple of minutes! How sweet!

However, these are virtual servers, bare metal. We still need to install our platform — runtimes, software, database etc on these servers. Finally we can deploy our application too.

The best thing is we are only charged for the amount of time we use the servers (to the nearest hour), making it quite cost-effective.

In addition to this, we are relieved (phew!) from the duties of maintenance and management, thus letting us focus of what we should be doing — writing more business code.

Organisations do not need to worry about these servers or hardware at all. These IaaS providers have already invested in hardware and people, so we don’t need to. All we can surely do is focus on business deliverables.

Providers like Amazon Webservices (AWS), Google Cloud Platform (GCP), Microsoft Azure let us rack up a fleet of customisable servers with just few clicks.

Moreover, the servers can be auto-scaled should the demand of the application increases during peak times or holiday periods, without us having to do anything.

Going with our housing analogy, this time we are not going to build a house.

Move into a pre-built house

Instead, we will move into a pre-built house! A builder has already developed the house that one can move in.

Hmm.. I need to buy stuff..

However, there is no furniture, no dining tables, no beds or mattresses none. You simply get four walls to occupy.

What we do is we get our own stuff before moving into this house!

Sheesh, do I need to install the platform?

Although the IaaS model is certainly a game changer, cloud providers budged a bit further. They cleverly devised another plan to take away the burden from the organisations of creating the platforms and runtimes.

And that’s where when they started introducing Platform-as-a-Service (PaaS).

All aboard the PaaS train — Platform-as-a-Service!

The Infrastructure-as-a-Service has then evolved into Platform-as-a-Service.

Instead of us creating the platform on the infrastructure they provide, we now get a readily available platform for us to just deploy our code executables and run!

We really don’t need to provision the runtimes or create the databases or worry about patches and upgrades on their servers. We can simply use readily available platforms like MEAN stack or NodeJS server or Java platform etc.

This has even more greater benefits, especially time to market a product or it’s features may drastically improve.

The house analogy is evolved too — we don’t have to buy any furniture or kitchen utensils. We are now moving into a fully furnished house! Everything is available from dishwashers to tumble dryers to perhaps clothes hangers!

Loving this furnished architecture, err, house!

All we have to do is move in and start using it.

Next stop: Functions-as-a-Service (FaaS)

The Platform-as-a-Service has then taken another great turn in the form of Functions-as-a-service (FaaS). That is, the Serverless technology is what the cloud providers have now to offer!

We don’t have to worry about installing the platforms or runtimes anymore.

Although Serverless seems “serverless”, it’s not that there are no servers at all! The servers exist, it’s just that you and me can’t modify a thing or manage them. They are owned by the cloud providers and they take care of running our code cleverly.

All we need to focus is creating our business logic using functions and deploy them to the servers. Let the platform take care of creating the containers and the required runtimes for executing our code.

For example, say I need to send an email for every new order created. The email function gets invoked for every order automatically, sends the email goes back to hibernation until next invocation.

The benefit of this service is two fold: we write just the logic we need for our business and we are charged only for the amount of memory and execution time it took for our code to run.

Our responsibility is to write code as we have asked for such distraction-free coding.

The AWS’s offering of such Serverless technology is AWS Lambda and Google’s is Cloud Functions. It’s Azure Functions from Microsoft Azure.

AWS Lambda is the Compute platform part of AWS where Lambda functions are code snippets packaged up and deployed onto a AWS Lambda platform. While Cloud Functions is similar in concept, integrated very well with the Google Cloud Platform including it’s Firebase/Firestore realtime database engines.

Don’t like doing dishes :(

Although we moved into a fully furnished apartment (PaaS), we still need to do our dishes. We have to do our beds. We have to clean our kitchen sinks, toilets.

Wouldn’t it be better if we don’t have to do any of this?

That’s exactly what a serviced houses or apartments are for. They are not only furnished but also serviced regularly!

Let me work, please!

Similar to a hotel except no room service!

The FaaS is what the backbone of Serverless computing architectures.

We are embarking on a phenomenon of outsourcing everything except business logic in the form of Functions-as-a-service. Who knows may be Business as a Service may be the next one to kick off in few years!

Summary

Serverless computing is the future! It is one of those technologies that would increase developer productivity dramatically, bring down costs radically and deliver the features drastically!

Stay tuned for the set of next articles where we learning the Serverless computing implementations such as AWS Lambdas and Google Cloud Functions!

--

--

Madhusudhan Konda

Madhusudhan Konda is a full-stack lead engineer, mentor, and conference speaker. He delivers live online training on Elasticsearch, Elastic Stack &Spring Cloud