Serverless computing architecture or Functions as a Service (FaaS) has gained quite a bit of popularity these days. In serverless computing, developers need not worry about application servers, virtual machines, Containers, infrastructure, scalability, and other quality of services. Instead, developers write functions and drop those functions into an already running computing infrastructure. Serverless computing improves faster software deliveries as it eliminates the provisioning and management part of the infrastructure required by microservices. Sometimes, this is even referred to as NoOps.
FaaS platforms support multiple language runtimes, such as Java, Python, Go, and so on. There are many serverless computing platforms and frameworks available. Moreover, this space is still evolving. AWS Lambda, IBM OpenWhisk, Azure Functions, Google Cloud Functions are some of the popular managed infrastructures for serverless computing. Red Hat Funktion is another serverless computing platform on top of Kubernetes, which can be deployed on any cloud or on premise. IronFunctions is one of the recent entrants--a cloud-agnostic, serverless computing platform. There are other serverless computing platforms, such as Webtask for web-related functions. BrightWork is another serverless computing platform for JavaScript applications that offers minimal vendor locking.
There are many other frameworks intended to simplify AWS Lambda development and deployment supporting different languages. Apex, Serverless, Lambda Framework for Java, Chalice for Python, Claudia for Node JS, Sparta for Go, and Gordon are some of the popular frameworks in this category.
Serverless computing is closely related to microservices. In other words, microservices are the basis for serverless computing. There are a number of characteristics shared by both, serverless computing as well as microservices. Similar to microservices, functions generally perform one task at a time, are isolated in nature, and communicate through designated APIs that are either event-based or HTTP. Also, functions have smaller footprints like microservices. It is safe to say that functions follow microservices-based architecture.
The following diagram shows a serverless computing scenario based on AWS Lambda:
In this scenario, each microservice will be developed as a separate AWS Lambda function and independently wired through an API gateway for HTTP-based communication. In this case, each microservice holds its own data in an Amazon DynamoDB.
Generally, the FaaS billing model is truly based on the pay as you use model, as opposed to pay for what is reserved model followed in case of virtual machines or EC2 instances. Moreover, developers need not worry about passivating images when they are no longer used. When there are only a few transactions, just enough computing power will be charged. As the load increases, more resources will be automatically allocated. This makes serverless computing an attractive model for many enterprises.
The new style of microservices use cases such as big data, cognitive computing, IoT, and bots, which are perfect candidates for serverless computing. More about these use cases is explained in the next section.
It is also important to note that the disadvantage of serverless computing is its strong vendor locking. This space is still getting matured, and, perhaps, we will see more tooling in this space to reduce these gaps. In the future, we will also see a large number of services available in the market place that can be utilized by microservice developers when developing on serverless computing platforms. Serverless computing, together with microservices architecture, is definitely a promising choice for developers.