GithubHelp home page GithubHelp logo

sjanulonoks / nuclio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuclio/nuclio

0.0 2.0 0.0 40.81 MB

High-Performance Serverless event and data processing platform

License: Apache License 2.0

Makefile 0.95% Go 77.35% CSS 2.07% JavaScript 10.17% HTML 1.04% Shell 1.24% Python 6.52% Smarty 0.08% Ruby 0.21% C 0.37%

nuclio's Introduction

Build Status Go Report Card Slack

nuclio - "Serverless" for Real-Time Events and Data Processing

Visit nuclio.io for product information and news and a friendly web presentation of the nuclio documentation.
Check out the global nuclio hackathon for a some serverless fun and a chance to win a Phantom 4 drone!

In this document

Overview

nuclio is a new "serverless" project, derived from iguazio's elastic data life-cycle management service for high-performance events and data processing. 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. To learn more about how nuclio works, see the nuclio architecture documentation and watch the technical CNCF nuclio presentation and demo (slides can be found here).

Note: nuclio is still under active development and is not recommended for production use.

Why another "serverless" project?

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 sources, triggers, 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 that supports constant addition of triggers and data sources. We hope many will join us in developing new modules, developer tools, and platforms.

Quick-start steps

The simplest way to explore nuclio is to run its graphical user interface (GUI) of the nuclio playground. All you need in order to run the playground is Docker:

docker run -p 8070:8070 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp nuclio/playground:stable-amd64

playground

Browse to http://localhost:8070 and deploy one of the example functions, or write your own function. When run outside of an orchestration platform (for example, Kubernetes or Swarm), the playground will simply deploy to the local Docker daemon.

For a complete step-by-step guide to using nuclio over Kubernetes, either with the playground UI or the nuclio command-line interface (nuctl), see Getting Started with nuclio on Kubernetes or Getting Started with nuclio on Google Kubernetes Engine (GKE).

High-level architecture

The following image illustrates nuclio's high-level architecture:

architecture

Following is an outline of the main architecture components. For more information about the nuclio architecture, see Architecture.

Services

Processor

A processor listens on one or more triggers (for example, HTTP, Message Queue, or Stream), and executes user functions with one or more parallel workers.

The workers use language-specific runtimes to execute the function (via native calls, shared memory, or shell). Processors use abstract interfaces to integrate with platform facilities for logging, monitoring and configuration, allowing for greater portability and extensibility (such as logging to a screen, file, or log stream).

Controller

A controller accepts function and event-source specifications, invokes builders and processors through an orchestration platform (such as Kubernetes), and manages function elasticity, life cycle, and versions.

Playground

The playground is a standalone container microservice that is accessed through HTTP and includes a code-editor GUI for editing, deploying, and testing functions. This is the most user-friendly way to work with nuclio. The playground container comes packaged with a version of the nuclio builder.

Builder

A builder receives raw code and optional build instructions and dependencies, and generates the function artifact - a binary file or a Docker container image that the builder can also push to a specified image repository. The builder can run in the context of the CLI or as a separate service, for automated development pipelines.

Dealer

A dealer is used with streaming and batch jobs to distribute a set of tasks or data partitions/shards among the available function instances, and to guarantee that all tasks are completed successfully. For example, if a function reads from a message stream with 20 partitions, the dealer will guarantee that the partitions are distributed evenly across workers, taking into account the number of function instances and failures.

Function concepts

Triggers

Functions can be invoked through a variety of event sources that are defined in the function (such as HTTP, RabbitMQ, Kafka, Kinesis, NATS, DynamoDB, iguazio v3io, or schedule). Event sources are divided into several event classes (req/rep, async, stream, pooling), which define the sources' behavior. Different event sources can plug seamlessly into the same function without sacrificing performance, allowing for portability, code reuse, and flexibility.

Data bindings

Data-binding rules allow users to specify persistent input/output data resources to be used by the function. (Data connections are preserved between executions.) Bound data can be in the form of files, objects, records, messages, etc. The function specification may include an array of data-binding rules, each specifying the data resource and its credentials and usage parameters. Data-binding abstraction allows using the same function with different data sources of the same type, and enables function portability.

SDK

The nuclio SDK is used by function developers to write, test, and submit their code, without the need for the entire nuclio source tree.

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"
)

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 hack/examples nuclio GitHub directory.

Global nuclio Hackathon

Sign up for the global online nuclio hackathon, build the greatest serverless application, and you just might win a Phantom 4 drone!

Judges include

  • Brendan Burns
    Kubernetes Co-Founder

  • Lee Calcote
    Head of Technology Strategy, SolarWinds

  • Yaron Haviv
    CTO, iguazio

  • Orit Nissan-Messing
    Chief Architect, iguazio

Submissions will be accepted until Jan 29 2018. Register now.

Further reading

For support and additional product information, join the active nuclio Slack workspace.

nuclio's People

Contributors

pavius avatar tebeka avatar eran-nussbaum avatar sharon-iguazio avatar bivas avatar balster1123 avatar omriharel avatar yaronha avatar dvrkps avatar ilaykav avatar tlossen avatar sbkoth avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.