Top Related Projects
Kubernetes-based, scale-to-zero, request-driven compute
OpenFaaS - Serverless Functions Made Simple
Kubernetes Native Serverless Framework
Fast and Simple Serverless Functions for Kubernetes
Apache OpenWhisk is an open source serverless cloud platform
⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
Quick Overview
Nuclio is a high-performance, serverless event and data processing platform. It's designed to run on various platforms, including Kubernetes and standalone, and supports multiple programming languages. Nuclio aims to provide a scalable and efficient solution for real-time data processing and AI/ML workloads.
Pros
- High performance: Nuclio offers extremely low latency and high throughput for data processing tasks
- Multi-language support: Developers can write functions in Python, Go, Node.js, Java, and more
- Flexible deployment: Can be deployed on Kubernetes, standalone, or in the cloud
- Built-in auto-scaling: Automatically scales based on workload demands
Cons
- Steep learning curve: May require significant time investment to fully understand and utilize all features
- Limited community support: Compared to some other serverless platforms, Nuclio has a smaller community
- Complex setup: Initial configuration and deployment can be challenging for beginners
- Limited documentation: Some advanced features may lack comprehensive documentation
Getting Started
To get started with Nuclio, follow these steps:
- Install Nuclio on your local machine or Kubernetes cluster:
# For local deployment
docker run -p 8070:8070 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp quay.io/nuclio/dashboard:stable-amd64
# For Kubernetes deployment
kubectl apply -f https://raw.githubusercontent.com/nuclio/nuclio/master/hack/k8s/resources/nuclio.yaml
- Create a simple function (e.g., in Python):
def handler(context, event):
return context.Response(body='Hello, Nuclio!',
headers={},
content_type='text/plain',
status_code=200)
- Deploy the function using the Nuclio CLI or dashboard:
nuctl deploy helloworld -p /path/to/function.py
- Invoke the function:
nuctl invoke helloworld
For more detailed instructions and advanced usage, refer to the official Nuclio documentation.
Competitor Comparisons
Kubernetes-based, scale-to-zero, request-driven compute
Pros of Serving
- More extensive ecosystem and community support within the Kubernetes landscape
- Offers a broader range of features for serverless applications, including traffic splitting and autoscaling
- Tighter integration with Kubernetes native resources and concepts
Cons of Serving
- Steeper learning curve due to its complexity and reliance on Kubernetes concepts
- Requires a full Kubernetes cluster, which can be resource-intensive for smaller deployments
- Configuration and setup can be more time-consuming compared to Nuclio's simplicity
Code Comparison
Nuclio function deployment:
apiVersion: "nuclio.io/v1beta1"
kind: NuclioFunction
metadata:
name: helloworld
spec:
handler: main:handler
runtime: python:3.6
Knative Serving deployment:
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-python
Both projects aim to simplify serverless deployments, but Serving offers a more comprehensive solution within the Kubernetes ecosystem, while Nuclio provides a more straightforward approach with a focus on high-performance functions. The choice between them depends on specific project requirements, existing infrastructure, and team expertise.
OpenFaaS - Serverless Functions Made Simple
Pros of OpenFaaS
- Broader language support and easier extensibility
- More active community and ecosystem
- Simpler architecture and easier to get started
Cons of OpenFaaS
- Less built-in performance optimization features
- Limited native support for complex event triggers
- Less focus on real-time processing capabilities
Code Comparison
OpenFaaS function example:
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
hello-world:
lang: python3
handler: ./hello-world
image: hello-world:latest
Nuclio function example:
apiVersion: "nuclio.io/v1"
kind: Function
metadata:
name: hello-world
spec:
runtime: python:3.7
handler: main:handler
build:
commands:
- pip install requests
Both frameworks use YAML for function configuration, but Nuclio's approach is more Kubernetes-native. OpenFaaS focuses on simplicity, while Nuclio provides more granular control over function behavior and resources.
OpenFaaS is generally easier to set up and use, with a larger community and ecosystem. It supports more languages out-of-the-box and has a simpler architecture. However, Nuclio offers better performance optimization features, more advanced event triggering capabilities, and is designed with a focus on real-time processing and data science workloads.
Kubernetes Native Serverless Framework
Pros of Kubeless
- Simpler setup and deployment process
- Native Kubernetes integration
- Supports multiple programming languages out-of-the-box
Cons of Kubeless
- Less active development and community support
- Limited advanced features compared to Nuclio
- Fewer built-in triggers and event sources
Code Comparison
Kubeless function example:
def hello(event, context):
print("Hello world!")
return event['data']
Nuclio function example:
def handler(context, event):
context.logger.info("This is an unstructured log")
return context.Response(body="Hello from Nuclio!",
headers={},
content_type="text/plain",
status_code=200)
Both Nuclio and Kubeless are serverless frameworks for Kubernetes, but they differ in their approach and features. Nuclio offers more advanced capabilities, such as real-time processing and built-in monitoring, while Kubeless focuses on simplicity and native Kubernetes integration. Nuclio has a more active development community and provides more extensive documentation. However, Kubeless may be easier to set up and use for simpler serverless applications. The choice between the two depends on the specific requirements of your project and your familiarity with Kubernetes.
Fast and Simple Serverless Functions for Kubernetes
Pros of Fission
- Simpler setup and deployment process
- Native Kubernetes integration
- Supports a wider range of programming languages
Cons of Fission
- Less advanced monitoring and observability features
- Limited built-in security features compared to Nuclio
- Fewer options for fine-grained resource control
Code Comparison
Fission function example:
def hello(context):
return "Hello, Fission!"
Nuclio function example:
def handler(context, event):
return context.Response(body="Hello, Nuclio!",
headers={},
content_type="text/plain",
status_code=200)
Both Fission and Nuclio are serverless frameworks for Kubernetes, but they have different approaches and features. Fission focuses on simplicity and ease of use, while Nuclio offers more advanced features and performance optimizations.
Fission's setup process is generally simpler, making it easier for beginners to get started. It also has better native integration with Kubernetes and supports a wider range of programming languages out of the box.
On the other hand, Nuclio provides more advanced monitoring and observability features, as well as built-in security options. It also offers more fine-grained control over resource allocation and performance tuning.
The code examples show that Fission functions are typically simpler to write, while Nuclio functions provide more control over the response structure and metadata.
Apache OpenWhisk is an open source serverless cloud platform
Pros of OpenWhisk
- Broader language support, including JavaScript, Python, Java, Swift, and more
- Extensive ecosystem with integrations for various cloud services and databases
- Mature project with strong community support and Apache Foundation backing
Cons of OpenWhisk
- More complex setup and deployment process
- Higher resource requirements for running the full platform
- Steeper learning curve for new users
Code Comparison
OpenWhisk action (JavaScript):
function main(params) {
var name = params.name || 'World';
return {payload: 'Hello, ' + name + '!'};
}
Nuclio function (Python):
def handler(context, event):
name = event.body.decode('utf-8') or 'World'
return context.Response(body=f'Hello, {name}!',
headers={},
content_type='text/plain',
status_code=200)
Both examples show simple "Hello, World" functions, but OpenWhisk uses a more straightforward approach with a single function, while Nuclio includes additional context and response formatting.
OpenWhisk offers a wider range of language support and integrations, making it suitable for complex, enterprise-level serverless architectures. Nuclio, on the other hand, focuses on simplicity and performance, particularly for real-time and data processing workloads. The choice between the two depends on specific project requirements and the development team's expertise.
⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
Pros of Serverless
- Broader cloud provider support (AWS, Azure, GCP, etc.)
- Larger community and ecosystem
- More extensive documentation and tutorials
Cons of Serverless
- Steeper learning curve for beginners
- Can be slower for rapid development and testing
- More complex configuration for advanced use cases
Code Comparison
Serverless (YAML configuration):
service: my-service
provider:
name: aws
runtime: nodejs14.x
functions:
hello:
handler: handler.hello
Nuclio (YAML configuration):
apiVersion: "nuclio.io/v1"
kind: Function
metadata:
name: helloworld
spec:
handler: main:handler
runtime: nodejs
Key Differences
- Serverless focuses on multi-cloud deployments, while Nuclio is primarily designed for Kubernetes environments
- Nuclio offers built-in auto-scaling and real-time processing capabilities
- Serverless provides a more extensive plugin system for customization
- Nuclio has better support for GPU-accelerated workloads
Use Cases
Serverless is ideal for:
- Multi-cloud serverless applications
- Projects requiring extensive customization
- Teams familiar with traditional cloud services
Nuclio is better suited for:
- Kubernetes-native serverless functions
- Real-time data processing and streaming
- High-performance computing and AI/ML workloads
Both frameworks aim to simplify serverless development, but they cater to different environments and use cases. Choose based on your specific requirements and infrastructure preferences.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Nuclio - "Serverless" framework for Real-Time Events and Data Processing
In this document
- Overview
- Why another "serverless" project?
- Quick-start steps
- How it works
- Function examples
- Further reading
Translations:
Overview
Nuclio is a high-performance "serverless" framework focused on data, I/O, and compute intensive workloads. It is well integrated with popular data science tools, such as Jupyter and Kubeflow; supports a variety of data and streaming sources; and supports execution over CPUs and GPUs. The Nuclio project began in 2017 and is constantly and rapidly evolving; many start-ups and enterprises are now using Nuclio in production.
You can use Nuclio as a standalone Docker container or on top of an existing Kubernetes cluster; see the deployment instructions in the Nuclio documentation. You can also use Nuclio through a fully managed application service (in the cloud or on-prem) in the Iguazio Data Science Platform.
If you wish to create and manage Nuclio functions through code - for example, from Jupyter Notebook - see the Nuclio Jupyter project, which features a Python package and SDK for creating and deploying Nuclio functions from Jupyter Notebook. Nuclio is also an integral part of the new open-source MLRun library for data science automation and tracking and of the open-source Kubeflow Pipelines framework for building and deploying portable, scalable ML workflows.
Nuclio is extremely fast: a single function instance can process hundreds of thousands of HTTP requests or data records per second. This is 10-100 times faster than some other frameworks. To learn more about how Nuclio works, see the Nuclio architecture documentation, read this review of Nuclio vs. AWS Lambda, or watch the Nuclio serverless and AI webinar. You can find links to additional articles and tutorials on the Nuclio web site.
Nuclio is secure: Nuclio is integrated with Kaniko to allow a secure and production-ready way of building Docker images at run time.
For further questions and support, click to join the Nuclio Slack workspace.
Why another "serverless" project?
None of the existing cloud and open-source serverless solutions addressed all the desired capabilities of a serverless framework:
- Real-time processing with minimal CPU/GPU and I/O overhead and maximum parallelism
- Native integration with a large variety of data sources, triggers, processing models, and ML frameworks
- Stateful functions with data-path acceleration
- Portability across low-power devices, laptops, edge and on-prem clusters, and public clouds
- Open-source but designed for the enterprise (including logging, monitoring, security, and usability)
Nuclio was created to fulfill these requirements. It was intentionally designed as an extendable open-source framework, using a modular and layered approach that supports constant addition of triggers and runtimes, with the hope that many will join the effort of developing new modules, developer tools, and platforms for Nuclio.
Quick-start steps
The simplest way to explore Nuclio is to run its graphical user interface (GUI) of the Nuclio dashboard. All you need to run the dashboard is Docker:
docker run -p 8070:8070 -v /var/run/docker.sock:/var/run/docker.sock --name nuclio-dashboard quay.io/nuclio/dashboard:stable-amd64
Browse to http://localhost:8070, create a project, and add a function. When run outside of an orchestration platform (for example, Kubernetes), the dashboard will simply deploy to the local Docker daemon.
Assuming you are running Nuclio with Docker, as an example, create a project and deploy the pre-existing template "dates (nodejs)".
With docker ps
, you should see that the function was deployed in its own container.
You can then invoke your function with curl; (check that the port number is correct by using docker ps
or the Nuclio dashboard):
curl -X POST -H "Content-Type: application/text" -d '{"value":2,"unit":"hours"}' http://localhost:37975
For a complete step-by-step guide to using Nuclio over Kubernetes, either with the dashboard UI or the Nuclio command-line interface (nuctl
), explore these learning pathways:
- Getting Started with Nuclio on Kubernetes
- Getting Started with Nuclio on Google Kubernetes Engine (GKE)
- Getting started with Nuclio on Azure Container Services (AKS)
How it works
"When this happens, do that". Nuclio tries to abstract away all the scaffolding around taking an event that occurred (e.g. a record was written into Kafka, an HTTP request was made, a timer expired) and passing this information to a piece of code for processing. To do this, Nuclio expects the users to provide (at the very least) information about what can trigger an event and the code to run when such an event happens. Users provide this information to Nuclio either via the command line utility (nuctl
), a REST API or visually through a web application.
Nuclio takes this information (namely, the function handler
and the function configuration
) and sends it to a builder. This builder will craft the function's container image holding the user's handler and a piece of software that can execute this handler whenever events are received (more on that in a bit). The builder will then "publish" this container image by pushing it to a container registry.
Once published, the function container image can be deployed. The deployer will craft orchestrator specific configuration from the function's configuration. For example, if deploying to Kubernetes the deployer will take configuration parameters like number of replicas, auto scaling timing parameters, how many GPUs the function is requesting and convert this to Kubernetes resource configuration (i.e. Deployment, Service, Ingress, etc).
Note: The deployer does not create Kubernetes native resources directly, but rather creates a "NuclioFunction" custom resource (CRD). A Nuclio service called the "controller" listens to changes on the NuclioFunction CRD and creates/modifies/destroys the applicable Kubernetes native resources (Deployment, Service, etc). This follows the standard Kubernetes operator pattern
The orchestrator will then spin up containers from the published container images and execute them, providing them the function configuration. The entrypoint of these containers is the "processor", responsible for reading the configuration, listening to event triggers (e.g. connecting to Kafka, listening for HTTP), reading events when they happen and calling the user's handler. The processor is responsible for many, many other things including handling metrics, marshaling responses, gracefully handling crashes, etc.
Scaling to Zero
Once built and deployed to an orchestrator like Kubernetes, Nuclio functions (namely, processors) can process events, scale up and down based on performance metrics, ship logs and metrics - all without the help of any external entity. Once deployed, you can terminate the Nuclio Dashboard and Controller services and Nuclio functions will still run and scale perfectly.
However, scaling to zero is not something they can do on their own. Rather - once scaled to zero, a Nuclio function cannot scale itself up when a new event arrives. For this purpose, Nuclio has a "Scaler" service. This handles all matters of scaling to zero and, more importantly, from zero.
Function examples
The following sample function implementation uses the Event
and Context
interfaces to handle inputs and logs, returning a structured HTTP response; (it's also possible to use a simple string as the returned value).
In Go
package handler
import (
"github.com/nuclio/nuclio-sdk-go"
)
func Handler(context *nuclio.Context, event nuclio.Event) (interface{}, error) {
context.Logger.Info("Request received: %s", event.GetPath())
return nuclio.Response{
StatusCode: 200,
ContentType: "application/text",
Body: []byte("Response from handler"),
}, nil
}
In Python
def handler(context, event):
response_body = f'Got {event.method} to {event.path} with "{event.body}"'
# log with debug severity
context.logger.debug('This is a debug level message')
# just return a response instance
return context.Response(body=response_body,
headers=None,
content_type='text/plain',
status_code=201)
More examples can be found in the Examples page.
Further reading
- Setup
- Getting Started with Nuclio on Docker
- Getting Started with Nuclio on Minikube
- Getting Started with Nuclio on Kubernetes
- Getting Started with Nuclio on Azure Kubernetes Service (AKS)
- Getting Started with Nuclio on Google Kubernetes Engine (GKE)
- Getting Started with Nuclio on Raspberry Pi (coming soon)
- Tasks
- Concepts
- References
- Examples
- Contributing
- Media
For support and additional product information, join the active Nuclio Slack workspace.
Top Related Projects
Kubernetes-based, scale-to-zero, request-driven compute
OpenFaaS - Serverless Functions Made Simple
Kubernetes Native Serverless Framework
Fast and Simple Serverless Functions for Kubernetes
Apache OpenWhisk is an open source serverless cloud platform
⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot