What is Serverless Computing? 🤔
Tags: serverless, aws, azure, googlecloud
Published: 2020-07-31 20:44:06

_Please note that this blog post is a compilation of my thoughts after working with different serverless solutions and reading the material provided by Amazon Web Services (Lambda Functions), Microsoft (Azure Functions), Google (Cloud Functions) and Twilio (Twilio Functions). The aim is to introduce you to the concept of serverless to pique your interest around this new computing paradigm._

# Okay. So what is Serverless?

Serverless architecture (also known as serverless computing) is a computing pattern where the application is hosted by a third-party service in a way where the developer does not need to manage the server software or hardware😍.
Simply put, serverless computing is a paradigm of computing that entirely manages the deployment and execution of the code while allowing the developer to focus on their application logic.

# And how does it differ from a PaaS (Platform as a Service) solution?

In the world of PaaS, your applications are deployed as a single unit using some kind of web framework like Ruby on Rails, Django, etc. These deployments can only be scaled at the application level and you have no choice but to run multiple instances of your entire application to handle any additional load😔.

With Serverless, also known as FaaS (Function as a Service), you can compose your application into individual, autonomous functions. Each function can be scaled individually and automatically as the function call frequency increases or decreases😃.

# But why is this important?

Being able to scale your functions individually and independently of the overall application is a very cost-effective🤑 way of paying for compute resources. This is because you will only pay for the number of times your function was called and the amount of time it spent performing the computation rather than paying to have your application always on and waiting for requests to come in.

# So when should you consider using Serverless?

- When you have a high volume of activities (like web requests, kew messages, transactions) and you want to isolate and scale tasks independently.
- Dynamic workloads: If you have dynamic workloads or run something infrequently, it might not make sense paying for compute 24 x 7. Using the serverless pattern ensures that you don't get charged until your functions are called.

# Wait. Does my cloud vendor even support this?
All major cloud vendors have an implementation of serverless computing in 2020 and so there is really no excuse to ignore it😜.

Amazon calls their implementation AWS Lambda, Microsoft calls their Azure Functions while Google calls it Cloud Functions. And while these names might differ they all pretty much do the exact same thing😂.

[AWS Lambda](https://aws.amazon.com/lambda/)
[Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview)
[Google Cloud Functions](https://cloud.google.com/functions)

# Shouldn't we be building vendor-agnostic solutions though?

If you really want to, sure. If you're someone that is on the multi-cloud train and aims to build a vendor-agnostic solution, there is something for you as well😉

[The Serverless Application Framework](www.serverless.com)

# Why don't we migrate everything to serverless then?
Serverless computing has some major benefits if used in the right way:
- Reduced service costs 💵 since you only pay for what you use and when you use it.
- Simplified scalability management - The cloud vendor (AWS in this case) manages uptime, availability, reliability, etc and most companies in the world would be better off letting the cloud vendor manage this for them.
- Quicker and smaller deployments since the code is now decoupled into smaller units

While there are clear benefits to using serverless, it comes with its own risks that need to be weighed before committing to it:
- Immaturity of the ecosystem and lack of tooling
- It is difficult/expensive to migrate current legacy systems/monoliths (data migration, people training, code rewrites, etc)
- The decoupling can lead to too many small parts to manage 😕 if things are not planned well. This is something we're seeing today in the discussion of monoliths and micro-services as well.

> Like most things in life, serverless comes with its own pros and cons. That being said, if used in the right scenario and built thoughtfully, the pros quickly outnumber the cons.

*** 

Thank you for reading! ❤️