nuclio / nuclio
- понедельник, 23 октября 2017 г. в 03:13:56
High-Performance Serverless event and data processing framework
nuclio is a new serverless project, derived from iguazio's elastic data life-cycle management service for high-performance events and data processing. nuclio is being extended to support a large variety of event and data sources. You can use nuclio as a standalone binary (for example, for IoT devices), package it within a Docker container, or integrate it with a container orchestrator like Kubernetes.
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. See nuclio Architecture to learn how it works.
nuclio technical presentation in slideshare and a video recording with demo.
Note: nuclio is still under development, and is not recommended for production use.
In This Document
We considered existing cloud and open-source serverless solutions, but none addressed our needs:
Real-time processing with minimal CPU and I/O overhead and maximum parallelism
Native integration with a large variety of data and event sources, and processing models
Abstraction of data resources from the function code, to support code portability, simplicity, and data-path acceleration
Simple debugging, regression testing, and multi-versioned CI/CD pipelines
Portability across low-power devices, laptops, on-prem clusters, and public clouds
We designed nuclio to be extendable, using a modular and layered approach. We hope many will join us in developing new modules and integrations with more event and data sources, developer tools, and cloud platforms.
The simplest way to explore nuclio is to run the nuclio playground (you only need docker):
docker run -p 8070:8070 -v /var/run/docker.sock:/var/run/docker.sock nuclio/playground
Browse to http://localhost:8070, deploy one of the example functions or write your own. You can then head over to the nuclio SDK repository for a complete step-by-step guide to using nuclio over Kubernetes and nuctl
- nuclio's command line interface.
For more information about the nuclio architecture, see nuclio Architecture.
The function demonstrated below, uses the Event
and Context
interfaces to handle inputs and logs, and returns a structured HTTP response (can also use a simple string as returned value).
in Golang
package handler
import (
"github.com/nuclio/nuclio-sdk"
)
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)
for more questions and help use nuclio slack channel