Skip to main content

Module clickhouse

Module clickhouse 

Source
Expand description

ClickHouse writer with bounded-channel backpressure.

ClickHouseWriter runs a background thread that receives Arrow RecordBatch values over a bounded sync_channel, serializes them to Arrow IPC stream format, and POSTs them to ClickHouse via HTTP.

§Backpressure

The bounded channel blocks the sender when the buffer is full, preventing the simulation from outrunning the writer.

§Delivery semantics

Delivery is tracked in three stages:

  • accepted into the writer channel
  • successfully sent to ClickHouse
  • dropped after all retries are exhausted

The writer exposes both live snapshots and final shutdown statistics so callers can distinguish enqueue success from durable delivery success.

§Retry

Failed HTTP requests are retried with exponential backoff and full jitter:

delay = random(0, min(max_retry_delay, base_retry_delay x 2^(attempt-1)))

Structs§

ClickHouseConfig
Configuration for the ClickHouse writer.
ClickHouseWriter
Background ClickHouse writer with bounded-channel backpressure.
WriterMetricsSnapshot
Live snapshot of background-writer metrics.
WriterStats
Statistics from the writer’s lifetime.

Enums§

ClickHouseError
Errors that can occur in the ClickHouse writer.
WriterMessage
Message type for the writer channel.