Open Source FAAS
Alok Sharma
Learner, Enabler|AI | Generative AI & Cloud Solutions Expert | Digital Transformation Strategist | AI/ML Innovator / TOGAF? 9 Certified/ AWS 3X (Professional Architect /Security certified
Serverless architectures have been rapidly gaining popularity. The main advantage of this technology is the ability to create and run applications without infrastructure management. Every CSP (Cloud service provider) has serverless FAAS (function as a service) like?AWS Lambda, Azure functions, Google's cloud function, etc.?
However, many open-source options are also available, like?Apache OpenWhisk, IronFunctions, Fn from Oracle, OpenFaaS, Kubeless, Knative, Project Riff, etc.
Some of the prime benefits of open source FAAS-?
1.?Open Source, Availability of Custom Features:?These are open-source solutions, unlike the other serverless solutions available in the industry. There is ample opportunity to build custom features.
2. On-prem, Data Security:?One can deploy these on-prem if the business is not Ok with data flowing to a third-party network & want to run things on its private network. It is good for specific compliance requirements.
3. No Vendor Lock-In:?Another massive advantage of using an open-source solution is?the no-vendor lock-in. In the case of multi-cloud, it is an essential point of consideration.
Open-source?FAAS General Architecture?is based on a cloud-native standard. It includes the following main components: API Gateway, Function Watchdog, and the container orchestrators Kubernetes, Docker Swarm, Prometheus, and Docker. Following high-level architecture is for OpenFAAS.
Apache OpenWhisk -?
One of the excellent and popular solutions in this category is Apache OpenWhisk. It is a serverless, open source cloud platform that allows you to execute code in response to events at any scale. It’s written in the Scala language. The framework processes the inputs from triggers like HTTP requests and later fires a snippet of code on either JavaScript or Swift.
How it works-
Backend functions are triggered via external events. The events can be triggered from datastores, message queues, mobile, web applications, sensors, chatbots, scheduled tasks, etc. These are also known as event sources.
The action box we see in the above diagram represents a function that holds the business logic. The function can be written in Go, Java, JavaScript, PHP, Python, Ruby, Swift. The functions encapsulating the business logic are stateless & can be triggered Via OpenWhisk REST-API, a command-line interface, user-created APIs, or scheduled automated triggers.
Underline technology-
It is powered by technologies such as?Apache Kafka, CouchDB, Docker & Nginx.?All these techs, all together, constitute an event-driven serverless programming service.
Function-Flow-
1.User Requests Hit OpenWhisk Platform
All the requests to OpenWhisk go through Nginx, an open-source web server. It also helps with several other functionalities such as load balancing, reverse proxy, caching, media streaming, etc.
领英推荐
2. Interception of user requests
Once the requests hit the platform, Nginx routes them to the Controller. The Controller is a Scala-based implementation of the REST API.
3.Authentication & Authorization-
The verification logic kicks in when the request moves from Nginx to the Controller. The Controller verifies if the request is valid & authentic. The requests are verified against the records stored in the subjects database in?CouchDB(An open-source NoSQL scalable, distributed database.).
4. Request Verification & invoke the Action
Once the user request is verified, the Controller figures out the type of web request & triggers an action. In other words, the requests execute the logic held in the functions from DB. Once the action is loaded from the database. The load balancer, which is a part of the Controller chooses one of the executors, also called the invokers.
5. Managing Heavy Load Scenarios & System Failure Contingencies with Kafka
OpenWhisk leverages Kafka, a distributed, high throughput messaging system to deal with triggering action like loss of invocation or execution . The invocations are buffered & persisted by Kafka until the action is invoked.
6. Invoking the Action with Docker
All the actions in OpenWhisk are invoked in the Docker containers. When an action is to be invoked, OpenWhisk spawns a Docker container, injects the action, passes the run parameters to the action & executes it. Once the action gets executed, Docker container is destroyed. All the results & the metadata of the invocation is stored in the activations database in CouchDB.
In the end, it is good to know that IBM Bluemix OpenWhisk(Now IBM cloud function) -?is a FaaS Functions platform of IBM based on the open-source serverless project Apache OpenWhisk.
Fn Project
It runs on container-native serverless approach. This is one of the most amazing serverless approaches which users can run anywhere, i.e., on-premises or on any cloud. This platform is super easy to use and can support any of your preferred programming languages.
Iron Functions
It is effective microservices platform . This is an effective serverless platform which is offering an innovative and cohesive microservices platform by integrating embracing Docker and its existing services. Go language can be used by the developers to write functions.
Serverless architecture is offering amazing benefits. There are various amazing serverless platforms one can choose from. All of these comes with their own features.
References -
https://openwhisk.apache.org/documentation.html#programming-model-triggers
https://www.cncf.io/blog/2020/04/13/serverless-open-source-frameworks-openfaas-knative-more/
https://www.redhat.com/sysadmin/get-started-serverless-computing
https://www.scaleyourapp.com/what-is-apache-openwhisk-why-use-it-everything-you-should-know-about-it/
https://opensource.com/article/18/11/open-source-serverless-platforms
https://blog.back4app.com/open-source-serverless-platform/
https://blog.logrocket.com/build-serverless-app-node-js-openwhisk/
Associate Director, Commerce Architecture Practice Lead and SAP as well as Salesforce Commerce Cloud Capability Lead at Accenture Song India
3 年Good article, open-source will flourish in FaaS area also