Nuclio is an open source project developed by Iguazio, an Israeli platform providing continuous, real-time, and high-speed data processing framework. Its teams believe that current Serverless services can provide the most fundamental FaaS: using Function to integrate with other services, in order to provide services or applications after integration.
The design of Serverless Function is single threaded through event-driven triggering. It is only operated when event invoked function.
This means each and every function can be triggered by different event, and connected to the required services to effectively provide services or applications after integration. Other than being called Function as a Service (FaaS), Serverless architecture is also called Back-end as a Service (BaaS) by many articles or blog posts. Yaron Haviv, CEO of Iguazio, believes that current serverless solutions cannot completely meet Iguazio’s requirements because serverless still has the following problems that need to be solved:
The architecture of Serverless greatly depends on information communication between functions and services so that there will be problems associated with IO required by different machines or services. However, there are two reasons that result in increased Round-Trip delay Time (RTT) problem:
In order to solve the above two problems, Iquazio uses Go language to come up with a non-blocking data access method to solve the first one. It allows function to obtain required access data in real time. To solve the second problem, Iquazio applies shared memory to achieve zero-copy data movement, reducing number of context switch. In addition, in order to cope with heavy traffic of function requirements, we can use Nuclio to scale out function container to redirect incoming data to each function container. Through the above methods, Nulico provides single process with 400,000 function requests per second, which is 10~100 times faster than major serverless solutions.
Currently there are many serverless services, but different FaaS provided by Serverless has different support from event and data resources, such as HTTP gateway, Kinesis, and SQS. Each event source will generate different event structure, as shown in Fig. 1. This represents that if Event Triggering of different platforms are not universal, then developers will be limited to that particular platform. For example, function(s) of AWS Lambda can only use Kinesis service provided by AWS to trigger.
As a result, Nuclio proposes an idea of Common Event Structure as shown in Fig. 2. It classifies and integrates all kinds of protocols and event sources, and it provides multiple options for serialization. Nuclio’s Common Event Source Approach was proposed as a specification at CNCF, expecting that other Serverless platforms can follow the spec to simplify the complexity and platform limits brought by the various event sources, which enables functions to be quickly deployed and connected to different event sources without the need to modify, and greatly improves the function portability. As the first proposer of this idea, Nuclio allows the same function code, without modification, to use the way similar to plugins to easily switch event sources, such as HTTP, Kinesis, Kafka, RabbitMQ, MQTT, NATS, Iquazio’s V3IO, File Content, or Event emulator, to trigger function(s) by means of rapidly modifying Event Consumer API.
As mentioned in 1.b above, each function is stateless, therefore state or content acquisition, result saving, and message transmission need to depend on external data services. To use these data services, such as MySQL, developers need to write or specify a fixed database connection, code related to identity authentication, or some environmental parameters within the scope of functions. As mentioned above regarding the event sources, these various data sources have the same problem: when data types or repositories of function changes, that function also lose portability, because same code will become useless.
To simplify the complexity of data sources and to resolve the issue in relation to code and service dependencies, Nuclio’s teams adopt data-binding rules promoted by Azure: providing pluggable data binding method, using required code for data binding to provide universal API calls, and putting the details of how to bind and verify data from the data resource linked by API to the scope outside of the function. In other words, it changes the processing role of data binding from developers to operators, and it allows developers to focus on function writing, and to let the functions be portable. This method provides the following features:
This can be divided into two parts. The first part discusses how a single serverless provider provides developing, debugging, testing, and deploying, while the second part describes how to let functions operate with different providers or under the cloud environment.
Firstly, it is not easy to use serverless functions to debug. Take AWS Lambda as an example, it does not support using breakpoint to debug, therefore developers need to use log information to debug. Moreover, serverless functions almost use container package to wait for the event triggering, thus the operation of each function essentially is deploying container. Since each time deploying a function is deploying a container, it means that if regression testing of that function cannot be automated, then redeploying new containers and deleting old function containers may occur each time the modified code of the same version function needs to be tested. Additionally, how to provide log parsing is also an important issue, since it will generate a lot of log information in the CI/CD process. Nuclio provides a few solutions for this as follows:
Secondly, developers may require to operate functions in the cloud. In addition to the consideration of cost and platform limits, similar functions may require to be run on different devices or edge servers for IoT or edge computing. As for the platform limits, it may rely on the cooperation with different serverless service providers, as mentioned in point 2) and point 3) above, to let function equip with portability for different devices. As for single platform for IoT or edge computing, it implies that Nuclio enables functions to have version number, and to support distributed and automated deployment to conduct further rolling or canary deployment.
Written by 呂威廷 迎棧科技工程師