Stream processing in Rust, with a Flink-inspired DataStream API.
flink-rs helps you build typed streaming pipelines and explore familiar
DataStream patterns in Rust. The workspace includes a local execution engine,
time-based windows, and runnable workloads from streaming benchmarks.
Run the complete Nexmark query suite with a deterministic auction stream:
cargo run --release -p flink-rs-nexmark -- --query all --events 100000Each query prints its input count, output count, elapsed time, throughput, and checksum. See the workload guide for more ways to explore the project.
use flink_rs_streaming::ExecutionEnvironment;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let environment = ExecutionEnvironment::new();
let result = environment
.from_collection([1, 2, 3, 4])
.filter(|value| value % 2 == 0)
.map(|value| value * 10)
.collect();
environment.execute()?;
assert_eq!(result.values()?, vec![20, 40]);
Ok(())
}- Typed pipelines: sources, maps, filters, flat maps, unions, and sinks.
- Keyed streams: per-key reductions and rich user functions with lifecycle hooks.
- Time-based processing: event-time and processing-time windows, sessions, triggers, allowed lateness, and late-data side outputs.
- Local execution: bounded and polling sources with watermarks, timers, and validated execution plans.
- Runnable workloads: Nexmark, Yahoo Streaming Benchmark, DSPBench, DEBS 2014 and 2022, Linear Road, Theodolite, TPCx-IoT-style, and Flink JMH ports.
Explore the API, run the workloads, and follow upcoming work on the roadmap.
A Criterion run on Apple Silicon (100,000 records per case, 2026-11-11):
| Workload | Million records/s |
|---|---|
| Global windows | 3.76 |
| Tumbling windows | 3.70 |
| Sliding windows | 0.86 |
| Session windows | 1.18 |
| Tuple key-by | 11.23 |
| Array key-by | 8.88 |
Run the full local suite with:
cargo bench -p flink-rs-flink-jmh --bench flink_jmh_portSet FLINK_RS_JMH_FILTER to a workload name, such as tumblingWindow, to
focus on one case. See the benchmark guide
for full-size options and details about the measurement setup.
Licensed under MIT or Apache-2.0.