Function as a Service (FaaS)
What is Function as a Service (FaaS)?
Functions-as-a-Service (FaaS) is a relatively new model of cloud computing that was pioneered by start-up companies like PiCloud and hook.io in the early 2010s. The model is based on serverless computing technologies and architectures that allow software developers to easily deploy applications in the cloud without having to manage servers.
FaaS uses serverless architecture to execute small, modular pieces of code known as functions. When cloud service providers take care of the server management aspect of application deployment, software developers benefit from cost-efficiency, scalability and simplified processes - and they can spend more time focused on writing application logic and less time managing servers and deployments.
What is a Function?
To fully appreciate the FaaS model and how it can benefit software developers, we need to clarify two important bits of terminology:
- What is Serverless Architecture?
- What is a Function?
Serverless architecture does not literally mean that the application runs without a server. It should be obvious that any application deployment requires some kind of hardware host. The defining feature of serverless architecture or serverless computing is that a cloud service provider takes responsibility for managing the application servers and dynamically allocating storage space based on the needs of users. In this sense, serverless architecture is only serverless for the developer - cloud service providers are still very much involved in the management of servers.
A function is a task or operation within an application that can be written as a discrete piece of code and executed independently. You can think of functions as extensions of the microservice architecture:
Early applications were written using monolithic architecture. The application was structured as a single executable that had to be triggered all at once. As best practices evolved, software developers increasingly adopted a microservice architecture for application design. Applications were re-imagined as a modular collection of microservices that would be easier to test and maintain and independently deployable. If a microservice can only perform one action in response to an event, it could be considered a function. More complex microservices that can perform several actions may be comprised of several functions.
How Does Functions-as-a-Service Work?
FaaS is a cloud service execution model, so an organization that wishes to take advantage of FaaS should start by forming a relationship with a cloud service provider that advertises FaaS capabilities.
In the FaaS delivery model, developers have no responsibility for maintaining application servers. Instead, they are hosted externally by the service provider and allocated dynamically based on the needs of the customer. FaaS service providers enable software developers to deploy pieces of code known as functions that can be executed on-demand.
When the function is called, the service provider spins up a server, executes the function, then shuts down. Unlike other models where software developers run the application on a dedicated server, serverless architecture is only active when the function is actively being used. Once the function has been executed, it can be shut down again, allowing the same computing resources to be allocated elsewhere.
With functions-as-a-service, software developers have access to a platform that executes application logic on demand and where all of the application resources are secured and coordinated by the service provider. The FaaS model works best for simple, repetitive functions such as schedule routine tasks or jobs, processing web requests or processing queue messages.
How Does Functions-as-a-Service Impact Scalability?
As an analogy, think about your kitchen as a monolithic application with capabilities like "keeping food cold", "heating food" and "baking". Monolithic applications scale by replicating the entire application on multiple servers, so if you need to do more baking, you would have to purchase an entire additional kitchen.
If we divided your kitchen into microservices, they might include a refrigerator, a freezer, a cooking stove, a coffee-maker, and a microwave. Microservice applications scale by replicating only the required services, so if you needed more capacity for baking, you could provision additional ovens without having to deploy a whole new kitchen.
What happens when we start dividing microservices into their individual functions?
An appliance like the coffee-maker has a single function - making coffee - while your refrigerator probably serves several functions - dispensing water, making ice, and keeping your food cold. Each of these functions would get its own unique piece of code under a serverless architecture, and each individual function could be scaled independently of the others. This represents the most efficient use of resources, as there is no need to deploy a full application or even an entire microservice when scaling a single function.
What are the Benefits of Functions as a Service?
Simplified Developer Logistics
Software development teams love the FaaS service model because it significantly simplifies the process of getting application updates and new code out to users. With server infrastructure management fully optimized and outsourced, software developers can spend more time doing what they do best. That means more agility, faster updates and more responsiveness to customer needs.
Cloud services are highly scalable by design and FaaS is no exception. The key difference is that the FaaS model allows individual functions to be scaled automatically and independently based on their usage. This represents the most efficient use of computing resources to service an application, as there is very little waste when compared to scaling discrete microservices or the entire application
Lower Up-front Costs
The FaaS service model means that software development teams spend less money up-front on hardware, operating systems and other IT infrastructure that is more easily outsourced. Dedicated servers are expensive to purchase and often underutilized, where the pay-as-you-go model offered by FaaS providers ensures that developers are only out-of-pocket for the computing resources they actually use.
Managed infrastructure comes with significant benefits in terms of availability, tolerance, security and other maintenance tasks that software developers in the past would have had to manage themselves.
Sumo Logic: Continuous Monitoring of Functions in the Cloud
For AWS Lambda subscribers, Sumo Logic's Lambda App makes it easy to achieve continuous monitoring of function execution activity. Users can track where an invoke API call came from, which function was executed, and capture detailed client context, user information and function details for a single function, a group of functions or all functions in a single AWS account. Features like error detection, threat detection, and performance metrics make Sumo Logic an indispensable tool for software developers working in the cloud-based FaaS model.