/tremor-runtime

Main Tremor Project Rust Codebase

Primary LanguageRustApache License 2.0Apache-2.0

CNCF Early Stage Sandbox Project

CNCF Streaming & Messaging


Gitpod


Build Status Quality Checks License Checks Security Checks codecov Dependabot Status CII Best Practices GitHub Discord


In short, Tremor is an event- or stream-processing system. It is designed to perform well for high-volumetric data both in terms of consumption of memory and CPU resources and in terms of latency. The goal of Tremor is to be a convenient tool for the operator at the time of configuring Tremor and at runtime in a production setup. We provide our own LSP for Tremor configurations and take great care of providing insightful metrics and helpful error messages at runtime. All this while keeping the hot data-path as performant as possible.

Tremor is well suited for ETL workloads on structured and binary data (both schemaless and strictly schematic), aggregations, traffic shaping and routing purposes.

Tremor speaks various protocols (TCP, UDP, HTTP, Websockets, DNS) and can connect to various external systems such as Kafka, Influx compatible stores, syslog, Open telemetry, Google Pubsub, Google BigQuery, S3 and many more.

Audience

Tremor is a real-time event processing engine built for users that have a high message volume to deal with and want to build pipelines to process, route, or limit this event stream. Tremor supports vast number of connectors to interact with: TCP, UDP, HTTP, Websockets, Kafka, Elasticsearch, S3 and many more.

When to use Tremor

  • You want to apply traffic-shaping to a high volume of incoming events
  • You want to distribute events based on their contents
  • You want to protect a downstream system from overload
  • You wish to perform ETL like tasks on data.

When not to use Tremor

Note: Some of those restrictions are subject to change as tremor is a growing project.

We currently do not recommend tremor where:

  • Your event structure is not mappable to a JSON-like data structure.
    • If in doubt, please reach out and create a ticket so we can assist and advice
    • In many cases ( textual formats ) a preprocessor, postprocessor or codec is sufficient and these are relatively easy to contribute.
  • You need connectivity to a system, protocol or technology that is not currently supported directly or indirectly by the existing set of connectors.
    • If in doubt, please reach out and create a ticket so we can assist and advise.
  • You require complex and expensive operations on your event streams like joins of huge streams. Tremor is not built for huge analytical datasets, rather for tapping into infinite datastreams at their source (e.g. k8s events, syslog, kafka).

We accept and encourage contributions no matter how small so if tremor is compelling for your use case or project, then please get in touch, reach out, raise a ticket and we're happy to collaborate and guide contributions and contributors.

Examples

See our Demo for a complex Tremor setup that can easily be run locally by using docker compose.

Checkout the Recipes on our website. Each comes with a docker compose file to run and play with without requiring lots of dependencies.

Packages

We do provide RPM, DEB and pre-compiled binaries (x86_64 only) for each release.

Check out our Releases Page.

Docker

Docker images are published to both Docker Hub and Github Packages Container Registry.

Container registry Image name
docker.io tremorproject/tremor
ghcr.io tremor-rs/tremor-runtime/tremor

We publish our images with a set of different tags as explained below

Image tags Explanation Example
edge Tracking the main branch
latest The latest release
0.X.Y The exact release 0.12.1
0.X The latest bugfix release for 0.X 0.12
0 The latest minor release for 0 0

Building the Docker Image

Tremor runs in a docker image. If you wish to build a local image, clone this repository, and either run make image or run docker compose build. Both will create an image called tremorproject/tremor:latest.

Note that since the image is building tremor in release mode it requires some serious resources. We recommend allowing docker to use at least 12 but better 16 gigabytes of memory and as many cores as there are to spare. Depending on the system building, the image can take up to an hour.

Providing too little resources to the docker machine can destabilize the docker build process. If you're encountering logs/errors like:

(signal: 9, SIGKILL: kill)
# OR
ERROR: Service 'tremor' failed to build : The command '/bin/sh -c cargo build --release --all --verbose' returned a non-zero code: 101

It is likely that your docker resources are starved. Consider increasing your resources (Windows/Mac) before trying again, posting in Discord, or raising an issue.

Running

To run tremor locally and introspect its docker environment, do the following:

make image
docker run tremorproject/tremor:latest

A local shell can be acquired by finding the container id of the running docker container and using that to attach a shell to the image.

docker ps

This returns:

CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS               NAMES
fa7e3b4cec86        tremorproject/tremor:latest      "/tremor-runtime.sh"   43 seconds ago      Up 42 seconds                           gracious_shannon

Executing a shell on that container will then give you local access:

docker exec -it fa7e3b4cec86 sh

Building From Source

⚠️ Local builds are not supported and purely at your own risk. For contributing to Tremor please checkout our Development Quick Start Guide

If you are not comfortable with managing library packages on your system or don't have experience with, please use the Docker image provided above.

For local builds, tremor requires rust 2021 (version 1.76 or later), along with all the tools needed to build rust programs. Eg: for CentOS, the packages gcc, make, cmake, clang, openssl, and libstdc++ are required. For different distributions or operating systems, please install the packages accordingly. NOTE AVX2, SSE4.2 or NEON are needed to build simd-json used by tremor. So if you are building in vm, check which processor instruction are passed to it. Like lscpu | grep Flags For a more detailed guide on local builds, please refer to the tremor development docs.

ARM/aarch64/NEON

To run and compile with neon use:

RUSTCFLAGS="-C cpu-target=native" cargo +nightly build --features neon --all

Configuration

Tremor is configured using .troy files written in our own Troy language.

Custom Troy modules can be loaded from any directory pointed to by the environment variable TREMOR_PATH. Directory entries need to be separated by a colon :.

Docker

For use in docker Troy files should be mounted to /etc/tremor/config.

Custom Troy modules and libraries should be mounted to /usr/local/share/tremor.

Example

This very simple example will consume lines from stdin and send them to stdout.

define flow example
flow
  # import some common pre-defined pipeline and connector definitions
  # to use here and save some typing
  use tremor::pipelines;
  use tremor::connectors;

  # create instances of the connectors and pipelines we need
  create connector console from connectors::console;
  create pipeline pass from pipelines::passthrough;

  # connect everything to form an event flow
  connect /connector/console to /pipeline/pass;
  connect /pipeline/pass to /connector/console;
end;

deploy flow example;

Run this example in file example.troy with docker:

$ docker run -i -v"$PWD:/etc/tremor/config" tremorproject/tremor:latest

Please also look at the demo for a fully documented example.

For more involved examples check out our Recipes.

Local Demo

Note: Docker should run with at least 4GB of memory!

To demo run make demo, this requires the tremorproject/tremor image to exist on your machine.

Design

The demo mode logically follows the flow outlined below. It reads the data from data.json.xz, sends it at a fixed rate to the demo bucket on Kafka and from there reads it into the tremor container to apply classification and bucketing. Finally, it off-ramps statistics of the data based on those steps.

╔════════════════════╗   ╔════════════════════╗   ╔════════════════════╗
║      loadgen       ║   ║       Kafka        ║   ║       tremor       ║
║ ╔════════════════╗ ║   ║ ┌────────────────┐ ║   ║ ┌────────────────┐ ║
║ ║ tremor-runtime ║─╬───╬▶│  bucket: demo  │─╬───╬▶│ tremor-runtime │ ║
║ ╚════════════════╝ ║   ║ └────────────────┘ ║   ║ └────────────────┘ ║
║          ▲         ║   ╚════════════════════╝   ║          │         ║
║          │         ║                            ║          │         ║
║          │         ║                            ║          ▼         ║
║ ┌────────────────┐ ║                            ║ ┌────────────────┐ ║
║ │  data.json.xz  │ ║                            ║ │     tremor     │ ║
║ └────────────────┘ ║                            ║ └────────────────┘ ║
╚════════════════════╝                            ║          │         ║
                                                  ║          │         ║
                                                  ║          ▼         ║
                                                  ║ ┌────────────────┐ ║
                                                  ║ │    grouping    │ ║
                                                  ║ └────────────────┘ ║
                                                  ║          │         ║
                                                  ║          │         ║
                                                  ║          ▼         ║
                                                  ║ ┌────────────────┐ ║
                                                  ║ │  stats output  │ ║
                                                  ║ └────────────────┘ ║
                                                  ╚════════════════════╝

Configuration

Config file

The demo configuration can be inspected and changed in the demo/configs/tremor/config/main.troy file.