Skip to content

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

ClickHouse 13 min read How-to mediumAdept

Supercharging your large ClickHouse data loads - Part 3: Making a large data load resilient

Multi-day loads of billions to trillions of rows into ClickHouse can survive transient failures by splitting the input into retryable tasks. ClickPipes covers managed ingestion from Kafka. For other sources, the open ClickLoad script loads Parquet files from object storage. Stateless workers claim file-chunk tasks from a KeeperMap-backed table and insert each chunk into a per-worker staging table via INSERT INTO SELECT. On failure they truncate and retry; on success they move partitions to the target table, giving exactly-once storage without costly mutations or deduplication. The design scales roughly linearly with workers and servers (3→6 servers doubled throughput from 4M to 8M rows/s on a 600B-row load), works with any partition key, and also covers projections and materialized views through cloned staging tables.

Related posts

  • Ensuring reliable OpenTelemetry ingestion at scale

    ClickHouse mediumAdept

    ClickHouse's LogHouse OpenTelemetry pipeline, ingesting 50 million events per second, absorbs database backpressure by failing over to S3 rather than buffering in memory, local WALs or Kafka. Collector file_storage WALs forced StatefulSets, drained slowly (about 4 hours per TiB) and queued fresh data behind backlog in FIFO order. The final design uses the OTel failoverconnector to route to ClickHouse first and spill to S3 only under backpressure, which limits PUT costs to outage windows. A separate scale-to-zero collector replays spilled blobs via SQS event notifications. Key details include disabling the ClickHouse exporter's sending queue so errors reach the connector, keeping inline retries, enabling the queue on the S3 exporter, and spreading keys across a wide keyspace to avoid prefix throttling.

  • ClickHouse Newsletter October 2022: A cloud has arrived

    ClickHouse mediumAdept

    ClickHouse Cloud entered public beta, storing data on shared object storage reachable by all nodes, so users no longer configure replication, sharding or rebalancing, and storage costs less than on block storage. Version 22.9 adds an experimental `annoy` ANN vector index, a KeeperMap table engine, `insert_quorum = auto`, INTERSECT/EXCEPT DISTINCT and an official TypeScript Node.js client. The query-of-the-month section shows that more threads can hurt. An S3 insert with `max_threads = 100` exhausts memory, while 4 threads beat autodetection by 33%. Under concurrent load, `max_threads = 1` tripled throughput from 3.8 to 13.1 QPS.

  • How we built our Internal Data Warehouse at ClickHouse: A year later

    ClickHouse mediumAdept

    ClickHouse's internal data warehouse on ClickHouse Cloud now ingests about 6 billion rows (50 TB uncompressed) a day from nineteen sources and holds 470 TB compressed. A single monolithic Airflow hourly load job was replaced by dbt-managed transformations split into nine processes, which improved reliability and handled data arriving at different times across sources. Semi-structured real-time data such as Google Analytics nested arrays and JSON control-plane offloads is exposed both raw and as dbt-built aggregates joined into batch reports. Access points expanded from Superset to the ClickHouse Cloud SQL console, Growthbook for A/B tests, and an S3-mediated export to Salesforce, and the team plans to use compute-compute separation to scale ETL and BI workloads independently and cut costs.

  • Supercharging your large ClickHouse data loads - Part 1: Performance and resource usage factors

    ClickHouse mediumAdept

    ClickHouse ingest performance and resource usage for large loads into MergeTree tables are governed by three factors: insert block size, insert parallelism, and hardware size. Larger insert blocks use more memory but produce fewer initial parts and so fewer background merges. Block size is controlled by min_insert_block_size_rows/bytes when the server pulls data, and by max_insert_block_size when clients push data or async inserts are used. Parallelism comes from max_insert_threads, s3/url glob reads, cluster table functions like s3Cluster, and parallel clients, while more CPU and RAM raise part size limits, parallelism and merge throughput.

  • How we built the Internal Data Warehouse at ClickHouse

    ClickHouse mediumAdept

    ClickHouse's internal data warehouse ingests tens of sources (Control Plane, Data Plane, AWS CUR, GCP billing, Salesforce, M3ter and others) into S3 hourly, then loads them into ClickHouse Cloud with the s3 table function and transforms them in SQL. Airflow schedules the work and Superset serves BI to about 100 users. Idempotency comes from ReplicatedReplacingMergeTree with FINAL plus re-runnable DAGs. Consistency comes from insert_quorum=3 rather than "auto", so inserts fail and retry during node restarts instead of leaving replicas incomplete. The team also found it needed a third intermediate business-entity layer beyond raw and mart, chose a single large transformation DAG over Airflow dataset triggers, and drives database-level access control from Google groups mapped to tables, columns and row filters.

The quest for software engineering knowledge.

Look:
Layout: