Serverless Part 1 – What is Serverless?

What is Serverless?

Have you ever been in charge of hosting a website? Ever had to maintain autoscaling infrastructure to manage the load of a website? We have on several occasions, and there have even been times with late 1am phone calls to bring back a site that has collapsed, all due to heavy traffic. As applications have modernised, we now have more infrastructure requirements to provide highly available solutions.

What makes an application or website highly available?

ef=”http://flusharcade.com.au/wp-content/uploads/auto-scale.png”> Automatic scaling of your infrastructure[/cap

1. Autoscaling

Aligning infrastructure to automatically grow and shrink to host required load running an application or website. Its important because applications have varying loads. Websites have times where there will be 10k concurrent users one day, or a 1k users another day. All loading dynamic content from different geographical regions, so we must have scalable infrastructure to serve this content without falling over.

2. Multi-region

If our applications and websites are running in multiple regions, we increase availability. What’s the benefit? We have a failover region or backup, and we can balance load between two regions based on geography if we apply some sort of load balancing or traffic management.

tp://flusharcade.com.au/wp-content/uploads/infra-diagram.png”> Fig 2. Traffic manager used for load balancing between two Australian regions with Azure

[/caption]Note

We should also include a Web Application Firewall (WAF) in front of our load balancing service to centralise management of security.

As we begin to move through all the bits and pieces, we start to increase time and cost spent on managing infrastructure. If we have to manage infrastructure in multiple regions our management costs increase. This is where serverless steps in to greatly reduce this management.

Serverless is basically a PaaS service for hosting workflows, backends and APIs for applications and websites. We don’t manage any infrastructure, we simply spin up a PaaS service.

Some of the benefits of serverless include:

  1. Manage Apps, Not Servers
  2. Instant, automatic scale
  3. Micro-billing

.com.au/wp-content/uploads/pov-blog-diagram3.png”> Fig 3. AWS lambda used as an even trigger to run a workflow every time a file is uploaded to an S3 bucket

[/caption]Already 37% of enterprise customers are using serverless, with most customers reporting up to 90% cost savings. All cloud platforms offer a serverless service. Azure has Functions and Logic AppsAWS has Lambda, and Google Cloud offers Functions. AWS was the first to the market, they are the largest provider of serverless and still growing at a rapid rate. In 2017, Lambda adoption is among 26% of all apps built using AWS technologies. In 2018, AWS reported a 400% growth in Lambda adoption across applications built on AWS. These are huge numbers, so its worth taking note as most future apps are moving towards this style of development.

Micro-billing means you are charged based on the number of calls to the service. Azure Logic Apps and Functions have a free tier model providing 1,000,000 calls per month for free.

What about Multi-region?

Let’s keep it all PaaS. In the case of AWS, we simply spin up an API gateway service which has two endpoints to two different lambda services in two different regions. Keep in mind this setup is not a native service of lambda, but this is how we build a failover mechanism using serverless on AWS.

wp-content/uploads/1_ZEKCTfmAVoU4P5BG1AzfwA.png”> Fig 4. High availability with serverless on AWS Lambda and API gateway

[/caption]In our next article we will look into each cloud platform’s serverless option, look at sample architecture and compare costs between all options.

Posted in Blog, Learn