Function as a Service(FaaS) is a serverless model where code written in any of the supported languages is run on the cloud, without the developer having to worry about the underlying hardware and software requirements. The term used is serverless, but is a misleading one, as there are servers that the cloud provider employs, which is transparent to the developer. FaaS enables modular development based on microservices, as opposed to monolithic codebase development. These modular pieces of code are typically executed on the edge servers.
This modular codebase based development is an efficient way to implement microservices-based architecture. Now what are microservices, one might ask. In this architecture, the application or system is imagined as a collection of smaller functional units or services, which are easy to develop, maintain, test and can be coupled or decoupled easily. Each microservice can be thought of as a collection of functions and each of these functions can be developed and run independently, loosely coupling them together. The figure below presents a perspective.
Each of those functions can be run on a FaaS platform enabling developers to focus on development, while the allocation of resources to run the function is taken care of by the FaaS provider. Using serverless code like in FaaS, web developers can focus on writing application code, while the serverless provider takes care of server allocation and backend services. The FassS provider will also scale the function to enterprise-level automatically based on the demand.
With developers not having to worry about servers and deployments, code is delivered faster.
The FaaS infrastructure will auto-scale the code for heavy use and the developer does not have to spend any time or resources building the code for scalability.
In the FaaS model, billing is based on computation time alone, which means businesses do not have to pay for the time the functions are not in use. Also, the cost of provisioning computing servers be it on-premise or on the cloud, to run these microservices is saved with the FaaS provider managing on both hardware and software sides, not to mention the manpower required to manage these resources.
With FaaS, developers need only code for security within the application and not worry about security breaches on the infrastructure. FaaS provider will ensure the functions are running within a secure perimeter with all relevant updates in place.
Application deployment becomes easier with FaaS where the provider manages all deployment-related dependencies.
This is something that comes along with a microservices architecture and with a third party managing the infrastructure part, the thing gets a little tougher. Testing and debugging might also incur the cost for the usage of computing resources.
Thorough testing of a microservices architecture based application using FaaS will require more intensive and complex test cases.
FaaS, will introduce an inherent latency into the applications and thus does not make it a suitable choice for applications that require high performance.
Execution time on the FaaS platform is a premium and there are limits on execution time. For example, it is 500s on Google and 300s on AWS.
In what scenarios can FaaS be useful
Functions on the FaaS platform can be triggered in an event-driven fashion. For example, when an object gets added to buckets in cloud storage, a function can be triggered to verify the contents of the object and take appropriate action. Data processing that involves some action once an event takes place like images or videos when available or uploaded, ETL and batch processing jobs or sensor data updates from IoT devices are all perfect use cases for FaaS.
Functions on FaaS can also come in handy when enhancing the functionality of an application with the use of APIs, without modifying the current functionality of the application.
Any move to the cloud requires meticulous planning and strategic thinking, and so is the case with FaaS. Since FaaS integration means the application code might be delivered from the edge, a global network with strategically located edge servers becomes necessary for an application that is designed for a global presence. Businesses might have to invest in cloud storage for the various event-based triggering of functions. Choosing the right provider with a global presence will go a long way.
AWS, with its Lambda service, stands out, supporting several languages like Node.js, Java, Python, C# and more. AWS Lambda also offers its newly released feature Provisioned Concurrency where functions are kept initialized and hyper ready to respond in much shorter periods. AWS Lambda also offers monitoring systems like Dashbird and CLoudwatch for a granular view of serverless processes.
Google Cloud Functions is another big name in the cloud space, supporting Node.js, Python, Go, Java and .NET with integrated monitoring, logging and debugging capabilities.
Microsoft Azure Functions is again a major player in the FaaS space supporting Node.js, C#, F#, Python, PHP and Java. A 3rd party language support helps run anything with batch files. Azure Functions also come with an advance monitoring system, Azure Application Insights featuring integrated monitoring and troubleshooting capabilities.
IBM Apache OpenWhisk Functions is an open-source offering in the FaaS space from a big player in the market. It natively supports languages like Node.js, Swift, Java, PHP, Go and Python. Using Docker containers it is capable of running code written in any other programming language.
There are some limitations that each one of the services above operates in, like in AWS Lambda operates memory in the range of 128MB to 1536MB with a maximum duration of 300 seconds. Google Cloud Functions is limited to 1000 functions with a maximum duration of 540 seconds. Azure Functions limits itself to only 10 concurrent executions per one function and in IBM Apache OpenWhisk Functions, package nesting is not allowed.
FaaS is a new way of looking at the entire application and might bring in changes to the application architecture of the future. Developers have to adapt to this new way of building and deploying code. FaaS has its advantages and drawbacks. In the long run, the advantages will overcome the drawbacks.
Jigsaw Academy’s Postgraduate Certificate Program In Cloud Computing brings Cloud aspirants closer to their dream jobs. The joint-certification course is 6 months long and is conducted online and will help you become a complete Cloud Professional.