Skip to content

bizon-rs (Native Streaming Worker)

bizon-rs is a native streaming worker for Bizon. It reads Kafka and writes to BigQuery through the Storage Write API. It reads bizon’s YAML format, accepting a strict subset of it, and writes byte-identical rows, so you can swap the worker without changing tables or downstream queries.

The current release is v0.6.0. Like bizon-core, it is licensed under GPL-3.0.

Use bizon-rs in place of the Python worker for pipelines with this shape:

  • source.name: kafka with sync_mode: stream
  • destination.name: bigquery_streaming_v2
  • engine.runner.type: stream

Anything else, including other sources, destinations, runners, and sync modes, stays on bizon-core. See Supported Configuration for the exact subset.

Kafka ──▶ decode (Avro via schema registry | UTF-8 JSON) ──▶ built-in transform ──▶ proto row
◀── commit acknowledged offsets ◀── AppendRows on <table>/_default, one pipelined connection per table
Measurementbizon-rsPython worker
CPU per row (Debezium sample, ~2 KB rows, one core)~6.6 µs~35–40 µs
Write throughput, one AppendRows connection from GKE~118 MiB/s sustained for 15 min (ack p50 146 ms, p99 250 ms)—
Resident memory, low-volume CDC pipelinetens of MiB—

One production deployment moved 23 Kafka pipelines (all six built-in types, 13 Kafka clusters, 93 pods) from the Python worker to bizon-rs, keeping the same tables. It compared one week on each worker:

Python workerbizon-rs
CPU used, average38.5 cores2.5 cores15× less
Memory used, average231 GB11 GB21× less
CPU per GB of Kafka traffic0.40 core-h0.048 core-h8.2× less
CPU per 1,000 rows written4.8 core-s0.47 core-s10× less
Pods OOM-killed100
Freshness p95, Debezium CDC tables2.7–3.4 min1.2 s

The week on the Python worker carried 1.85× the traffic, so CPU per GB and CPU per row are the fairest ratios.

Each release publishes Linux tarballs for x86_64 and aarch64. The binaries are built on Debian 12 (bookworm), so they need glibc from Debian 12 or newer.

Terminal window
VERSION=v0.6.0
curl -LO https://github.com/bizon-data/bizon-rs/releases/download/${VERSION}/bizon-stream-${VERSION}-x86_64-unknown-linux-gnu.tar.gz
tar -xzf bizon-stream-${VERSION}-x86_64-unknown-linux-gnu.tar.gz
./bizon-stream --version

For ARM, use aarch64-unknown-linux-gnu in place of x86_64-unknown-linux-gnu.

A multi-arch image (linux/amd64, linux/arm64) is published to GHCR:

Terminal window
docker run --rm ghcr.io/bizon-data/bizon-rs:0.6.0 --help
TagPoints to
ghcr.io/bizon-data/bizon-rs:<version>A release. The version has no leading v, for example 0.6.0.
ghcr.io/bizon-data/bizon-rs:latestThe latest release

The image is based on gcr.io/distroless/cc-debian12:debug-nonroot, and its entrypoint is bizon-stream. The debug variant includes busybox, so kubectl cp can fetch the output of capture.

Building from source needs Rust 1.87+ and a C toolchain. librdkafka and protoc are vendored.

Terminal window
git clone https://github.com/bizon-data/bizon-rs.git
cd bizon-rs
cargo build --release -p bizon-stream # target/release/bizon-stream

The binary is called bizon-stream. The run, check-config, and capture commands take --config, which defaults to /app/config/config.yml.

CommandDescription
runStart the streaming worker
check-configValidate a config against what bizon-rs supports, then print the topic count, record schema count, transform, encoding, batch_size, and consumer_timeout
captureRead a sample of messages into parity fixtures, without joining the consumer group or committing
append-smokePush synthetic rows through AppendRows to benchmark the write client
Terminal window
bizon-stream check-config --config config.yml
bizon-stream run --config config.yml
bizon-stream capture --config config.yml --since 1h --out ./capture
OptionDefaultDescription
--since1hStart point: epoch milliseconds, or a duration ago such as 30m, 6h, or 2d
--per-topic200Messages to capture per topic
--max-wait-secs300Maximum time to wait for messages
--topicsAll topics in the configA comma-separated subset of the config’s topics
--outRequiredOutput directory

append-smoke writes to a table with the schema id INTEGER REQUIRED, payload JSON, __inserted_at TIMESTAMP. It needs --rows, --duration-secs, or both, and stops at whichever limit it reaches first.

Terminal window
bizon-stream append-smoke --table my-project.scratch.smoke --duration-secs 60 --writers 2
OptionDefaultDescription
--tableRequiredTarget table as project.dataset.table
--rowsUnlimitedRows per writer
--duration-secsUnlimitedDuration of the run
--batch500Rows per request
--row-bytes1024Approximate payload size per row
--max-inflight4Requests in flight per writer
--writers1Concurrent connections to the same table
--endpointBIZON_RS_BQ_WRITE_ENDPOINTStorage Write endpoint override
--quota-project—Quota project for the requests

bizon-rs reads the same config file as the Python worker, but it accepts only a subset. check-config and startup reject anything outside that subset. Unknown keys are rejected as well, so run check-config before you switch a pipeline over.

FieldRequired value
source.namekafka
source.sync_modestream
source.authentication.typebasic
source.authentication.schema_registry_typeapicurio (the default)
source.topicsA non-empty list. The streams: form is not supported.
destination.namebigquery_streaming_v2
destination.config.unnesttrue
destination.config.bq_max_rows_per_request10000 or less (default 5000)
destination.config.record_schemasOne entry for every topic’s destination_id
transformsExactly one transform, using either builtin or a recognised python template
engine.runner.typestream

Source

FieldDefaultNotes
bootstrap_serversRequired
group_idbizon
topics[].name, topics[].destination_idRequireddestination_id is project.dataset.table
message_encodingavroavro or utf-8 (JSON)
consumer_configbizon’s defaultsPassed through to librdkafka. If you set it, your map replaces the defaults instead of merging with them.
consumer_timeout10Seconds. Also caps BIZON_RS_LINGER_MS.
batch_size100Accepted and printed by check-config. Batching uses bq_max_rows_per_request, bytes, and linger time instead.
skip_message_empty_valuetrue
skip_message_invalid_keysfalse
skip_message_on_decode_errorfalseDoes not cover schema registry outages. See Differences from the Python Worker.
authentication.params.username, .passwordRequiredSent as SASL PLAIN
authentication.schema_registry_url, _username, _password—Apicurio base URL with basic auth. Schemas are fetched from /apis/registry/v2/ids/globalIds/{id}.

When you leave consumer_config unset, the default is auto.offset.reset: earliest, enable.auto.commit: false, session.timeout.ms: 45000, max.poll.interval.ms: 600000, and security.protocol: SASL_SSL. bizon-rs always sets queued.max.messages.kbytes from BIZON_RS_QUEUE_KBYTES.

Destination

FieldDefaultNotes
project_id, dataset_idRequired
dataset_locationUSUsed for large-row load jobs
bq_max_rows_per_request5000Maximum 10000
time_partitioning—type and field, used when a table is created
record_schemas[].record_schemaRequiredname, type, mode (default NULLABLE), description, default_value_expression
record_schemas[].clustering_keys—Used when a table is created

These fields are accepted but ignored: source.stream (used only as a metrics tag), source.force_ignore_checkpoint, source.timestamp_ms_name, destination.config.max_concurrent_threads, buffer_size, buffer_flush_timeout, engine.runner.log_level (use RUST_LOG instead), and the top-level monitoring block.

BIZON_ENV_* values resolve from the environment, as they do in bizon-core. A string value that starts with BIZON_ENV_ is replaced by that variable’s value. The replacement is read as a YAML scalar, so "5000" becomes an integer. env://NAME values are resolved too, and an unset one is an error. Placeholders inside lists are not resolved, matching bizon-core.

An unset BIZON_ENV_* variable becomes null. A required field that ends up null fails validation, and the error lists the unset variables. Set every referenced variable before you run check-config.

This config passes check-config on v0.6.0 when BIZON_ENV_BOOTSTRAP_SERVERS, BIZON_ENV_KAFKA_USERNAME, and BIZON_ENV_KAFKA_PASSWORD are set:

name: orders-events
source:
name: kafka
stream: topic
sync_mode: stream
bootstrap_servers: BIZON_ENV_BOOTSTRAP_SERVERS
group_id: orders-events
message_encoding: utf-8
batch_size: 1000
consumer_timeout: 30
topics:
- name: app.events.orders
destination_id: my-project.events.orders
consumer_config:
auto.offset.reset: earliest
enable.auto.commit: false
session.timeout.ms: 60000
security.protocol: SASL_SSL
partition.assignment.strategy: cooperative-sticky
authentication:
type: basic
params:
username: BIZON_ENV_KAFKA_USERNAME
password: BIZON_ENV_KAFKA_PASSWORD
destination:
name: bigquery_streaming_v2
config:
project_id: my-project
dataset_id: events
dataset_location: US
unnest: true
bq_max_rows_per_request: 5000
time_partitioning:
type: DAY
field: __inserted_at
record_schemas:
- destination_id: my-project.events.orders
record_schema:
# Fields of the JSON message key are spread into the row
- {name: order_id, type: STRING, mode: NULLABLE}
- {name: payload, type: JSON, mode: NULLABLE}
- {name: __operation, type: STRING, mode: NULLABLE}
- {name: __deleted, type: BOOLEAN, mode: NULLABLE}
- {name: __cluster, type: STRING, mode: NULLABLE}
- {name: __kafka_partition, type: INTEGER, mode: NULLABLE}
- {name: __kafka_offset, type: INTEGER, mode: NULLABLE}
- {name: __kafka_topic, type: STRING, mode: NULLABLE}
- {name: __schema, type: JSON, mode: NULLABLE}
- {name: __event_timestamp, type: TIMESTAMP, mode: NULLABLE}
- {name: __inserted_at, type: TIMESTAMP, mode: NULLABLE, default_value_expression: CURRENT_TIMESTAMP()}
clustering_keys: [order_id]
transforms:
- label: events
builtin: {name: json_events, cluster: my-cluster}
engine:
runner:
type: stream
Terminal window
docker run --rm -v $PWD:/app/config:ro \
-e BIZON_ENV_BOOTSTRAP_SERVERS -e BIZON_ENV_KAFKA_USERNAME -e BIZON_ENV_KAFKA_PASSWORD \
ghcr.io/bizon-data/bizon-rs:0.6.0 check-config
# ok: 1 topics, 1 record schemas, transform JsonEvents { cluster: "my-cluster" }, encoding Utf8, batch_size 1000, consumer_timeout 30s

For Avro topics, set message_encoding: avro and add schema_registry_url, schema_registry_username, and schema_registry_password under authentication. See the Kafka source reference and the BigQuery destination reference for what each field means.

bizon-rs never executes Python. Instead, it ships six native transforms that cover the common streaming shapes. Each one takes cluster, which is written to __cluster. Only debezium_unwrap takes another option.

Built-inInputRow
debezium_unwrapAvro Debezium envelopepayload = after (before for deletes), plus operation, deleted flag, and record schema
avro_eventsAvro recordpayload = the record. __schema = its top-level fields.
cloudeventsJSON with CloudEvents headerspayload = value. ce_type and ce_id headers required, ce_time optional.
cloudevents_enrichedJSON, any headersAs cloudevents, plus every header in headers. All ce_* headers optional.
json_cdcJSON {before, after}payload = after, __before = before, plus the ce_type and ce_id headers
json_eventsJSONpayload = value

Every built-in also spreads the message key’s fields into the row, and adds the Kafka partition, offset, and topic, plus __event_timestamp and __inserted_at.

transforms:
- label: debezium
builtin:
name: debezium_unwrap
cluster: my-cluster
columns_to_remove:
app.cdc.users: [password_hash]

columns_to_remove is optional and set per topic. The listed columns are dropped from payload and from __schema.

transforms:
- label: events
builtin: {name: cloudevents, cluster: my-cluster}

The other built-ins use the same short form: json_events, json_cdc, cloudevents_enriched, and avro_events.

A config that carries an inline python: transform is accepted only when the code matches one of the six templates bundled in crates/bizon-stream/src/transform/templates/. bizon-rs selects the template by comparing the code, not the label. It then reads the per-pipeline literals from the code: the __cluster value and, for Debezium, the TOPIC_COLUMN_TO_FILTER deny-list. Any other Python is rejected at startup.

A transform must set exactly one of builtin or python. For general-purpose Python transforms on the Python worker, see Transforms.

Settings that are not part of bizon’s config come from BIZON_RS_* variables, so the mounted config can stay identical to the Python worker’s.

VariableDefaultDescription
BIZON_RS_INFLIGHT_BYTES64 MiBEncoded bytes in flight before consuming pauses
BIZON_RS_LINGER_MS1000Maximum time a partial batch waits. Capped at consumer_timeout.
BIZON_RS_QUEUE_KBYTES16384librdkafka queued.max.messages.kbytes
BIZON_RS_HEALTH_PORT8080Port for /healthz, /readyz, and /metrics
BIZON_RS_DRAIN_SECS20Drain budget on SIGTERM
BIZON_RS_DECODE_WINDOW4Messages decoded concurrently. Results still reach the tables in delivery order.
BIZON_RS_APPEND_DEPTH4AppendRows requests in flight per table
BIZON_RS_ENSURE_TABLEStrueCreate and extend tables before appending. Set false to skip.
BIZON_RS_STALL_SECS600/healthz fails once a consumed message has waited this long for its BigQuery ack. 0 disables the check.
BIZON_RS_RECOMMIT_SECS21600How often idle partitions’ offsets are committed again, so the broker doesn’t expire them (KIP-211). 0 disables it.
BIZON_RS_BQ_WRITE_ENDPOINT / BIZON_RS_BQ_REST_ENDPOINTGoogleEndpoint overrides, for example http://127.0.0.1:50051 for the bundled fake-bqwrite

Other environment variables:

VariableDescription
ENVIRONMENTOffsets are committed only when this is production, matching bizon-core. In any other environment, a restart re-reads from the last committed offset.
GOOGLE_APPLICATION_CREDENTIALSPath to a service account key. Without it, credentials come from the metadata server or Workload Identity.
RUST_LOGLog filter, for example debug or bizon_stream=debug. Default info.
HOSTNAMEUsed for the static membership ID and the pod_name metrics tag
DD_AGENT_HOSTEnables DogStatsD metrics. See Health and Metrics.
  • At-least-once. For each partition, bizon-rs tracks the contiguous range of offsets whose rows BigQuery has acknowledged (or that were skipped), and commits only up to that point.
  • Rebalancing. Set partition.assignment.strategy: cooperative-sticky in consumer_config, as in the example above. On a cooperative revoke, the worker flushes the revoked partitions, waits up to 10 seconds for their acks, and commits them before releasing them.
  • Static membership. group.instance.id defaults to <group_id>-$HOSTNAME, unless consumer_config sets it. A restarted pod rejoins without triggering a rebalance.
  • SIGTERM stops consuming, drains for up to BIZON_RS_DRAIN_SECS, commits, and exits 0.
  • Pipeline errors drain and commit what is safe (never the failing message), then exit non-zero.
  • Append retries. Retryable failures reconnect and resend unacknowledged requests. After a 5-minute retry budget, the worker exits.
  • Idle partitions have their offsets committed again every BIZON_RS_RECOMMIT_SECS. Otherwise the broker could expire them, and auto.offset.reset: earliest would re-read the topic.
  • Large rows. Rows over 8 MiB go through a BigQuery load job instead of AppendRows.
  • Tables are created with the configured time_partitioning and clustering_keys. Existing tables only ever get new columns. Types, partitioning, and clustering never change.
  • Memory is bounded by bytes in flight, not by a record count.

The rows are byte-identical, but some behaviour differs on purpose:

SituationPython workerbizon-rs
Schema registry outageSkips the messages under skip_message_on_decode_error, which loses dataStops the worker
Storage Write responsesIgnoredInspected. Per-row and in-response errors are fatal.
INVALID_ARGUMENT from BigQueryRetried for 4 minutes in every caseRetried only within 10 minutes of adding columns
BatchingPer pollStreaming, per table, by count, bytes, and linger time. Request limits match, but batch boundaries differ.
Schema cacheKeyed by full message bytes, unboundedKeyed by schema id

__inserted_at is taken per message from the wall clock, so its values differ from the Python worker’s by microseconds. A scale-0 Avro decimal beyond 64 bits, and NaN or Infinity in a JSON-string key, stop both workers on the same message. Only the reported stage differs.

The worker serves three endpoints on BIZON_RS_HEALTH_PORT (default 8080):

EndpointReturns
/healthz200 ok, or 503 stalled once the oldest unacknowledged message is older than BIZON_RS_STALL_SECS
/readyz200 ready once partitions are assigned, 503 not ready before
/metricsPrometheus text, with every series prefixed bizon_rs_

Key series:

SeriesTypeDescription
bizon_rs_messagescounterMessages consumed
bizon_rs_skipped{reason}counterSkipped messages, with reason set to empty_value, invalid_key, or decode_error
bizon_rs_rows_appended, bizon_rs_bytes_appendedcounterRows and bytes acknowledged by BigQuery
bizon_rs_append_requests, bizon_rs_append_latency_us_totalcounterAppendRows requests and their total ack latency
bizon_rs_append_latency_us_maxgaugeLargest ack latency since the last DogStatsD push
bizon_rs_append_retriescounterAppend retries
bizon_rs_large_rowscounterRows sent through a load job
bizon_rs_commits, bizon_rs_commit_failures, bizon_rs_recommitscounterOffset commits, failed commits, and idle re-commits
bizon_rs_partitions_assigned, bizon_rs_partitions_revokedcounterRebalance events
bizon_rs_schema_changescounterTable schema changes
bizon_rs_inflight_bytesgaugeEncoded bytes in flight
bizon_rs_assigned_partitionsgaugePartitions currently assigned
bizon_rs_oldest_unacked_secsgaugeAge of the oldest consumed message that is still waiting for an ack (0 when none is pending)
bizon_rs_consumer_lag{topic}gaugeCommitted-offset lag per topic, from librdkafka statistics

If DD_AGENT_HOST is set, the same series are sent to $DD_AGENT_HOST:8125 every 10 seconds as bizon_rs.*. They are tagged with pipeline, kafka_cluster (the transform’s cluster), version, and pod_name. Counters are sent as deltas.

Rows written per table are also sent as bizon-core’s bizon_pipeline.records_synced, using bizon-core’s tag keys (pipeline_name, pipeline_stream, pipeline_source, pipeline_destination, destination_id). As a result, existing Bizon dashboards cover both workers. Large rows are also counted in bizon_pipeline.large_records.

bizon-rs reads the same mounted config.yml as the Python worker, by default at /app/config/config.yml. To switch a pipeline, change the image and command, remove the unsupported engine keys, and add the BIZON_RS_* variables you need. For the Python-worker setup this replaces, see the Kafka to BigQuery tutorial.

  • Probes. Point the liveness probe at /healthz and the readiness probe at /readyz. A liveness failure restarts a worker whose writes have stopped making progress.
  • Memory. The memory ceiling is set by BIZON_RS_INFLIGHT_BYTES plus BIZON_RS_QUEUE_KBYTES, on top of a small baseline. Leave headroom for large messages: a 35-minute soak with bursty 15–30 KB JSON messages held steady at 453–464 MiB resident.
  • Shutdown. Keep terminationGracePeriodSeconds above BIZON_RS_DRAIN_SECS, so that the drain and the final commit can finish.
  • Static membership. A member that leaves does not send LeaveGroup. When you scale down, its partitions wait for session.timeout.ms before they are reassigned. The same mechanism lets a restarted pod rejoin without a rebalance.
  • Spread pods across nodes. In the production deployment above, the whole fleet fit on one preemptible node, and every replacement of that node restarted all pods. Those restarts set the worst-case freshness, at about 4 minutes.

A container spec fragment:

containers:
- name: bizon-rs
image: ghcr.io/bizon-data/bizon-rs:0.6.0
args: ["run", "--config", "/app/config/config.yml"]
env:
- name: ENVIRONMENT
value: production
- name: BIZON_RS_INFLIGHT_BYTES
value: "67108864"
ports:
- name: health
containerPort: 8080
livenessProbe:
httpGet: {path: /healthz, port: health}
readinessProbe:
httpGet: {path: /readyz, port: health}
volumeMounts:
- name: config
mountPath: /app/config

Add the BIZON_ENV_* variables referenced by your config (for example, from a Secret), and use Workload Identity or GOOGLE_APPLICATION_CREDENTIALS for BigQuery access.