Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 8 min read How-to mediumAdept

Kafka, Latency, and You: Minimizing Latency with Kafka & ClickHouse

End-to-end latency in a Kafka → Kafka Connect → ClickHouse pipeline can be measured by stamping messages with offset, partition, timestamp and topic via single message transforms, recording insert time with a DEFAULT now() column, and charting median/p75/p95 deltas per minute in SQL. Tuning levers include consumer fetch and poll settings (fetch.min/max.bytes, fetch.max.wait.ms, max.poll.records), keeping partitions modest with at least one task per partition, and batching inserts of 10,000–100,000 rows to avoid "Too Many Parts" errors. On the ClickHouse Cloud side, idle-sleep timeouts, instance sizing, and asynchronous inserts can cut latency, with async inserts giving weaker durability guarantees.

Related posts

  • Asynchronous Data Inserts in ClickHouse

    ClickHouse mediumAdept

    ClickHouse asynchronous inserts move batching from the client to the server. Insert data goes into in-memory buffers, one per query shape and settings on each node, and is flushed as larger parts, which avoids the 'Too many parts' error that frequent small synchronous inserts trigger. In a benchmark with a serverless uptime-monitoring app (UpClick), 200 cloud functions inserting every 10 seconds pushed a 3-node ClickHouse Cloud service to the 300-active-part limit within 5 minutes using synchronous inserts. The post then covers buffer flush semantics, deduplication for idempotent retries, errors that only surface at flush time, how asynchronous inserts compare to Buffer tables, and how to tune return behavior and flush settings.

  • Real-time Event Streaming with ClickHouse, Kafka Connect and Confluent Cloud

    ClickHouse mediumAdept

    ClickHouse's official Kafka Connect sink, which uses the KeeperMap table engine for exactly-once semantics, can now be deployed as a Confluent Cloud Custom Connector. The walkthrough streams public Ethereum datasets from Google Pub/Sub through a Confluent Kafka topic into ClickHouse Cloud using only UI configuration, cutting data latency from about 30 minutes with the earlier batch BigQuery export to roughly 4 minutes. Practical tips include using a pull subscription and raising the Pub/Sub acknowledgement deadline from 10s to 60s to avoid duplicate deliveries. Cost estimates are under $1/month for Pub/Sub on the blocks dataset and about $6/day for Confluent.

  • ClickHouse v21.11 Released

    ClickHouse mediumAdept

    ClickHouse 21.11 adds asynchronous inserts, which buffer many small concurrent INSERTs server-side and flush them as a single batch. This removes the need for Kafka or buffer tables in high-rate ingestion, and it is tunable via async_insert, wait_for_async_insert, async_insert_threads, async_insert_max_data_size and async_insert_busy_timeout_ms. The release also brings an interactive clickhouse-local CLI that needs no server, executable UDFs written in any language, named predefined connections to external sources such as MySQL and S3, and automatic compression handling for INTO OUTFILE and FROM INFILE.

  • Essential Monitoring Queries - part 1 - INSERT Queries

    ClickHouse mediumAdept

    ClickHouse system tables such as part_log, query_log, asynchronous_insert_log, asynchronous_metric_log and parts can be queried with SQL to monitor and troubleshoot INSERT workloads. Ready-to-use queries cover new part creation rate, bulk insert counts versus rows written, insert duration percentiles, per-insert memory and CPU, MaxPartCountForPartition, parts per partition, and part-level errors. Comparing insert request counts to rows written, or watching part counts climb, gives early warning of small-insert patterns and high-cardinality partition keys that lead to 'Too many parts' errors. Duration and resource metrics are only accurate for synchronous inserts, not async_insert or the Buffer engine, and alerting on these queries through tools like Grafana is recommended.

  • Announcing a New Official ClickHouse Kafka Connector

    ClickHouse mediumAdept

    ClickHouse released a beta open-source Kafka Connect sink that aims for exactly-once delivery into ClickHouse. Existing options all stop at at-least-once delivery: the Kafka table engine, Vector, and the JDBC/HTTP Kafka Connect sinks. The design builds on Kafka Connect's at-least-once behaviour and adds ClickHouse insert deduplication plus a state machine that forms consistent, repeatable batches. Connector state lives in ClickHouse Keeper, exposed through a new KeeperMap table engine because it offers linearizable writes without the latency of a strongly consistent replicated table. The connector supports most ClickHouse types, uses RowBinary for schema'd data and JSON for schemaless data, and has an in-memory test mode with no exactly-once guarantees.

The quest for software engineering knowledge.

Look:
Layout: