No description
This repository has been archived on 2026-11-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Rust 99%
  • Dockerfile 1%
Find a file
2023-06-10 12:03:33 +02:00
.github/workflows Rework GitHub workflows 2022-05-04 08:24:26 +02:00
docs/images feat: Implement proper ringbuffer mechanism so that commands can be distributed over multiple buffers :))) 2022-04-28 15:57:38 +02:00
grafana/provisioning Update grafana dashboard 2022-02-10 22:00:48 +01:00
prometheus feat: Add node exporter and Grafana Dashboards 2022-02-08 16:53:36 +01:00
src display text on top of screen 2023-06-10 12:03:33 +02:00
tests Update dependencies 2023-05-13 18:47:26 +02:00
.gitignore Update dependencies 2023-05-13 18:47:26 +02:00
Arial.ttf Add drawing of text 2022-01-16 13:30:05 +01:00
Cargo.lock Update dependencies 2023-05-13 18:47:26 +02:00
Cargo.toml Update dependencies 2023-05-13 18:47:26 +02:00
docker-compose.yml feat: Add node exporter and Grafana Dashboards 2022-02-08 16:53:36 +01:00
Dockerfile Fix Dockerfile order and bump Rust version 2022-05-05 08:00:39 +02:00
README.md Implement OFFSET command (#3) 2022-05-21 15:38:32 +02:00

breakwater

breakwater is a very fast Pixelflut server written in Rust. It is heavily inspired by Shoreline.

It claims to be the fastest Pixelflut server in existence - at least at the time of writing 02/2022. breakwater logo

Features

  1. Accepts Pixelflut commands
  2. Provides VNC server so that everybody can watch
  3. Exposes Prometheus metrics
  4. IPv6 and legacy IP support

Available Pixelflut commands

Commands must be sent newline-separated, for more details see Pixelflut

  • HELP: Prints a help text with the available commands.
  • PX x y rrggbb: Color the pixel (x,y) with the given hexadecimal color, e.g. PX 10 10 ff0000
  • PX x y rrggbbaa: Color the pixel (x,y) with the given hexadecimal color rrggbb (alpha channel is ignored for now), e.g. PX 10 10 ff0000ff
  • PX x y: Get the color value of the pixel (x,y), e.g. PX 10 10
  • SIZE: Get the size of the drawing surface, e.g. SIZE 1920 1080
  • OFFSET x y: Apply offset (x,y) to all further pixel draws on this connection

Usage

The easiest way is to continue with the provided Ready to use Docker setup below.

If you prefer the manual way (the best performance) you need to have Rust installed. You may need to install some additional packages with sudo apt install pkg-config libvncserver-dev Then you can directly run the server with

cargo run --release

The default settings should provide you with a ready-to-use server.

Port Description
1234 Pixelflut server
5900 VNC server
9100 Prometheus metrics exporter

The get a list of options try

cargo run --release -- --help
Output
cargo run --release -- --help
    Finished release [optimized] target(s) in 0.03s
     Running `target/release/breakwater --help`
breakwater 0.0.1

USAGE:
    breakwater [OPTIONS]

OPTIONS:
    -f, --fps <FPS>
            Frames per second the VNC server should aim for [default: 30]

        --font <FONT>
            The font used to render the text on the screen. Should be a ttf file [default:
            Arial.ttf]

    -h, --height <HEIGHT>
            Height of the drawing surface [default: 720]

        --help
            Print help information

    -l, --listen-address <LISTEN_ADDRESS>
            Listen address to bind to. The default value will listen on all interfaces for IPv4 and
            v6 packets [default: [::]:1234]

    -p, --prometheus-listen-address <PROMETHEUS_LISTEN_ADDRESS>
            Listen address zhe prometheus exporter should listen om. The default value will listen
            on all interfaces for IPv4 and v6 packets [default: [::]:9100]

    -t, --text <TEXT>
            Text to display on the screen. The text will be followed by "on <listen_address>"
            [default: "Breakwater Pixelflut server"]

    -v, --vnc-port <VNC_PORT>
            Port of the VNC server [default: 5900]

    -V, --version
            Print version information

    -w, --width <WIDTH>
            Width of the drawing surface [default: 1280]

You can also build the binary with cargo build --release. The binary will be placed at target/release/breakwater.

Compile time features

Breakwater also has some compile-time features for performance reasons. You can get the list of available features by looking at the Cargo.toml. To e.g. count the actual pixels colored by every IP enable the future count_pixels as follows. Please note that this will have a very larger performance penality.

cargo run --release --features count_pixels

Run in docker container

This command will start the Pixelflut server in a docker container

docker run --rm -p 1234:1234 -p 5900:5900 -p 9100:9100 sbernauer/breakwater # --help

The following command stops the server again (if there are some problems with SIGINT)

docker stop $(docker ps -q --filter ancestor=sbernauer/breakwater)

Ready to use Docker compose setup

The ready to use Docker compose setup contains the Pixelflut server, a prometheus server and a Grafana for monitoring. Use the following command to start the whole setup

docker-compose up

You should now have access to the following services

Port Description
1234 Pixelflut server
5900 VNC server
9100 Prometheus metrics exporter
9090 Prometheus server
80 Grafana

If you visit the Grafana server (user=admin, password=admin) you will have access to dashboards like the dashboard below. Grafana screenshot

Performance

Laptop

My Laptop has a Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (6 Cores/12 Threads) and 2 DDR4 RAM modules with 16 GB each and 2667 MT/s. The Pixelflut-server and Pixelflut-client Sturmflut both run on my Laptop using 24 connections. These are the results of different Pixelflut servers:

Server Language Traffic during first 30s When thermal throttling
Pixelnuke C 1.1 Gbit/s 1 Gbit/s
Pixelwar Java 2.1 Gbit/s 1.6 Gbit/s
pixelpwnr-server Rust 6.3 Gbit/s 4.6 Gbit/s
Shoreline C 15 Gbit/s 12 Gbit/s
Breakwater Rust 30 Gbit/s 22 Gbit/s

Server

The server has two Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz processors with 10 cores / 20 threads each. Another server was used as a Pixelflut-client Sturmflut. The servers were connected with two 40G and one 10G links, through which traffic was generated.

Server Language Sustainable traffic
Shoreline C 34 Gbit/s
Breakwater Rust 52 Gbit/s

Usage of Tokio

You can find a prototype with Tokio in the tokio branch. Performance measurements have shown that the usage of Tokio decreased the average performance from 22.9 to 21.6 Gbit/s.

Used benchmark
for i in $(seq 1 20); do
    for branch in master tokio; do
        git checkout $branch
        cargo run --release >/dev/null 2>/dev/null & sleep 2; ../sturmflut/sturmflut 127.0.0.1 ../sturmflut/cat.jpg -t 24 >/dev/null 2>/dev/null & sleep 10; bmon -b -p lo -o ascii:quitafter=3 | tail -n 1 | awk '{ print $2 }' | tee -a "perf/$branch"; killall sturmflut; killall breakwater
        sleep 1
    done
done

TODOs

  • Implement Alpha channel feature. For performance reasons there should be a compile-time switch (similar to #ifdef in C)