Have you heard of Function-as-a-Service (FaaS)? I use these weekly blogs to make sure I am constantly learning and when I came across FaaS it was an area of cloud that I wanted to learn more about.
Here is the definition of Function-as-a-Service from Wikipedia:
“Function as a service (FaaS) is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage application functionalities
without the complexity of building and maintaining the infrastructure typically
associated with developing and launching an app.
Building an application following this model is one
way of achieving a "serverless" architecture,
and is typically used when building microservices applications.”
Looking at this definition for Function-as-a-Service there are three areas into which to delve a bit deeper:
Category of cloud: FaaS is a new category of cloud to accompany Data-as-a-Service (DaaS), Infrastructure-as-a-Service (IaaS), Platform-as-a-Service (PaaS) and Software-as-a-Service (SaaS).
DaaS is an information provision and distribution model in which data files (including text, images, sounds, and videos) are made available to customers over a network, typically the Internet.
IaaS is a service model that delivers computer infrastructure on an outsourced basis to support enterprise operations. Typically, IaaS provides hardware, storage, servers and data center space or network components.
PaaS is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app.
SaaS is a method of software delivery and licensing in which software is accessed online via a subscription, rather than bought and installed on individual computers.
Serverless architecture: A cloud-computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources.
Microservices: This is an approach to application development in which a large application is built as a suite of modular components or services.
I like the diagram below that shows the difference between a monolithic, or traditional n-tired architecture, and a microservices architecture.
In the monolithic architecture you can have a n-tiered architecture that accesses a database. This n-tiered architecture is separated into the presentation layer, business logic layer and data access layer and each layer can reside on a single server or split to run on multiple servers.
In the microservices architecture the business logic layer is split into a number of microservices or Function-as-a-Service components.
Here are a few more diagrams that illustrate the microservice architecture.
The pros and cons of a FaaS architecture
As in all things there are pros and cons in using a microservices architecture. This list is taken from an written by a company called SmartBear and is titled “What is Microservices Architecture?”
Microservice architecture gives developers the freedom to independently develop and deploy services
A microservice can be developed by a fairly small team
Code for different services can be written in different languages (though many practitioners discourage it)
Easy integration and automatic deployment (using open-source continuous integration tools such as Jenkins, Hudson, etc.)
Easy to understand and modify for developers, thus can help a new team member become productive quickly
The developers can make use of the latest technologies
The code is organized around business capabilities
Starts the web container more quickly, so the deployment is also faster
When change is required in a certain part of the application, only the related service can be modified and redeployed—no need to modify and redeploy the entire application
Better fault isolation: if one microservice fails, the other will continue to work (although one problematic area of a monolith application can jeopardize the entire system)
Easy to scale and integrate with third-party services
No long-term commitment to technology stack
Due to distributed deployment, testing can become complicated and tedious
Increasing number of services can result in information barriers
The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency, and deal with a variety of message formats as well as load balancing
Being a distributed system, it can result in duplication of effort
When number of services increases, integration and managing whole products can become complicated
In addition to several complexities of monolithic architecture, the developers have to deal with the additional complexity of a distributed system
Developers have to put additional effort into implementing the mechanism of communication between the services
Handling use cases that span more than one service without using distributed transactions is not only tough but also requires communication and cooperation between different teams
The architecture usually results in increased memory consumption
Partitioning the application into microservices is very much an art
What are the benefits of using a FaaS architecture?
Here are a list of benefits found on a blog written by Skelia titled “5 MAJOR BENEFITS OF MICROSERVICE ARCHITECTURE”
Easier to build and maintain applications: The key principle of microservices is simplicity. Applications become easier to build and maintain when they’re split into a set of smaller, composable fragments.
Organised around business capabilities: Development teams are organized around business capabilities and not technologies.
Improved productivity and speed: The microservices architecture tackles the problem of productivity and speed by decomposing applications into manageable services that are faster to develop.
Flexibility in using technologies and scalability: Each microservice can be written using a different technology which simplifies the selection of the most appropriate tech stack for the specific needs of your service.
Autonomous and cross functional teams: Microservices grant the developers more independence to work autonomously and make technical decisions quickly in smaller groups.
Here is a list of reference material although a great deal more information can be found on the web:
What is Serverless Architecture? – Couchbase Blog
What is Microservices Architecture? – SmartBear
What Is Function-as-a-Service? – Stackify
What is FaaS? – dashbird
Migrating to Serverless – Big Business Benefits for established companies – dashbird
3 simple use cases for leveraging serverless – Kash Kashyap
Microservice Architecture Benefits and its Business Value – Sunflower Lab
Pattern: Microservice Architecture – Microservices Architecture
I hope you enjoyed this blog. Let me know if you are also on the journey of learning all things cloud? I look forward to engaging with you.
Introduction to Idea Management - FREE
Last year I collated the blogs I had written on Idea Management into an eBook titled “An introduction to Idea Management. If it a topic that interests you then you can send me an email and I will send you a copy. My email address is firstname.lastname@example.org.
The views expressed in this blog are my own and don't represent the views of the company I work for.