Serverless architecture (also known as serverless computing or function as a service, FaaS), gets us a step closer to independence from humans and brings us much closer to the machine dependency. For many people, serverless is their first exposure to the public cloud.
Despite the name, serverless architecture doesn’t mean that it runs its code without servers. In this solution there is no need for a company to buy, rent or provision servers/virtual machines for the back-end code to run on. This is a way of building and running applications and services without infrastructure management.
Since the term ‘serverless’ is confusing and there’s no one clear view of what serverless is, I encourage you to read the article by Mike Roberts where he gives a deep insight into this term.
‘Serverless is the evolution of cloud platforms in the direction of pure cloud-native code’.
It is the culmination of several iterations of cloud platforms. The evolution began with physical machine in the data center and progressed through Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Container as a Service (CaaS) to Function as a Service (FaaS). Best explanation you will find in this short, 4-minute video by Jason McGee (IBM’s CTO):
Serverless architecture significantly helps developers focus more on their core product, not the infrastructure. Otherwise, developers would still be worrying about implementing, maintaining, debugging, and monitoring the infrastructure, whether managing them in the cloud or on-site. Using serverless services like AWS Lambda, Google Cloud Functions, Firebase or Microsoft Azure Functions they will take care of the physical hardware, virtual machine operating system as well as the web server, while you – as a developer – would only need to worry about one thing — your code.
It depends. If you have a small number of functions to be hosted, you should consider switching to serverless. Having a more complex application, a serverless architecture can still be profitable, but you will need to architect your application differently. This may turn out to be impracticable if you have an existing application. The best solution, in this case, would be migrating smaller pieces of the application into serverless functions over time. I’ve encountered a clever car analogy by [Luciano Mammino (https://www.slideshare.net/loige/building-a-serverless-company-with-nodejs-react-and-the-serverless-framework-jsday-2017-verona) explaining whether to go serverless or no.
FaaS is an implementation of serverless architectures where engineers can deploy an individual function or a piece of business logic. It allows developers write and update a piece of code ‘on the fly’, which can then be executed in reply to an event, such as a user clicking on an element in a web application. This facilitates scaling code and is a cost-efficient way to implement microservices.
In other words, instead of scaling a monolithic REST server to handle the potential load, a developer can now split the server into a bunch of functions which can be scaled automatically and independently. If you’re familiar with microservices, this image might be helpful:
Some people argue that serverless should be referred to as function as a service (FaaS), and while it’s not a bad name, serverless is a much broader concept than just an ephemeral function running in the cloud. Learn why?:
The key properties of FaaS are:
- Independent, server-side, logical functions
- Ephemeral (may only last for one invocation)
- Scalable by default
- Fully managed by a Cloud vendor (a third party)
PaaS makes it easy to deploy an entire application. PaaS providers handle provisioning servers and deploying your application to the servers.
Function as a Service (FaaS) gives you the ability to deploy what is essentially a single function, or part of an application. Instead of the monolith app that you’d run on a PaaS, you break down your app into small self-contained programs, or functions.
After you have installed the serverless framework on your machine next thing is to choose where you’d like your serverless service to run. Choose your compute provider from below list and follow awesome guides by Serverless Inc. at https://serverless.com/framework/docs/getting-started/.
Below principles apply if you decide to create an entire system (back-end & front-end) using a serverless approach. If you are building other types of systems (a pipeline for transforming a file), the principle relevant to the front-end will not apply.
- Use a compute service to execute code on demand
- Write single-purpose, stateless functions
- Design push-based, event-driven pipelines
- Create thicker, more powerful front ends
- Embrace third-party services
According to the survey by Serverless, Inc. here is a list of cases when serverless is a good fit:
Here is the answer on Quora: https://www.quora.com/What-is-the-best-use-cases-for-serverless/answer/Max-Katz
Serverless is growing fast. Several key adoption metrics are 2x what they were last year. And not just with smaller companies – the enterprise is adopting serverless technologies for critical workloads just as rapidly. And there is clear evidence in the mentioned survey by Serverless, Inc.:
In comparison to previous years, more people are using multiple cloud providers. This fact increases the importance of projects such as CloudEvents and other initiatives that enable vendor choice. As for the best cloud computing conferences happening in 2019, a curated list you will find here.
Operationalizing serverless (debugging, monitoring, and testing) is the biggest issue at the moment and clearly, indicate a lack of tooling.