ClickHouse Keeper: A ZooKeeper alternative written in C++
ClickHouse Keeper is a C++ drop-in replacement for ZooKeeper with the same client protocol and data model. It adds better snapshot and log compression, no 1 MB node size limit, no ZXID overflow, faster partition recovery, and optional linearizable reads, and it is continuously validated with Jepsen tests. Measurements from loading WikiStat data into a 3-node ClickHouse Cloud service show how cluster size, part-size settings and data volume drive Keeper traffic, about 70% of which is multi-write transactions. A reusable keeper-bench-suite built on EC2, cAdvisor and Prometheus reproduces this workload and finds Keeper uses up to 46x less memory than ZooKeeper with comparable performance.
Related posts
- Bonree replaces ZooKeeper with ClickHouse Keeper for drastically improved performance and reduced costs
ClickHouse hardMaster
Bonree migrated the coordination layer of its ClickHouse-based observability platform from five 3-node ZooKeeper clusters to a single ClickHouse Keeper cluster. The move cut CPU and memory use by more than 75% and improved performance nearly 8x, and it eliminated Java full-GC stalls and replica sync backlogs. The migration was automated with Ansible: ingestion and merges are stopped (e.g. SYSTEM STOP MERGES), fresh snapshots are taken and converted, then data is sampled and verified, bringing a 2-3 hour manual process down to minutes. Bonree also modified clickhouse-keeper-converter to merge snapshots from multiple ZooKeeper clusters into one, handled mixed ACL encryption states, and replaced slow ZooKeeper path reads with a path log, cutting verification of 9 million paths from about 9 hours to seconds.
- ClickHouse 22.3 LTS Released
ClickHouse mediumAdept
ClickHouse 22.3 is a long-term support release (supported through March 2023) focused on maturity and reliability. ClickHouse Keeper, a Jepsen-tested drop-in ZooKeeper replacement, is now production ready. So are AArch64 builds, which already give better price/performance in major clouds, and MergeTree/ReplicatedMergeTree on S3, though zero-copy replication is not yet ready and GCP has known issues. The release also adds reproducible hermetic builds, X.509 authentication, more fuzzing with randomized settings and backward-compatibility tests, and an experimental JSON type that stores inferred dynamic subcolumns in columnar form. Other changes include up to 2x faster MergeTree inserts, up to 3x faster large IN lists, and a hybrid RAM/disk cache for remote filesystems.
- What’s New in ClickHouse 21.12
ClickHouse mediumAdept
ClickHouse 21.12 marks ClickHouse Keeper as feature complete: it now supports ZooKeeper's four-letter monitoring commands and works as a drop-in ZooKeeper replacement, with compressed, checksummed logs and no zxid overflow or JVM tuning. The release adds partitioned writes for the File, URL and HDFS engines, glob and parallel reads for INSERT FROM INFILE, INTERVAL steps in ORDER BY WITH FILL, and Identifier query parameters for safely substituting table and database names. It also introduces an experimental Bool type and constraint-based query optimization, where CHECK and new ASSUME constraints rewrite queries to cheaper columns and hypothesis indexes record precomputed conditions. Arrow-family formats read from s3, url and hdfs are now fetched in chunks via range requests above 1 MiB, so large files no longer have to be loaded fully into memory.
- No more disks: the architecture behind stateless compute in ClickHouse Cloud
ClickHouse hardMaster
ClickHouse Cloud compute nodes are now fully stateless and diskless. The last local dependency, database metadata stored as .sql files, has been removed by a new in-memory Shared database engine backed by a versioned Shared Catalog in Keeper. The architecture got there in stages: SharedMergeTree moved table data to object storage, a distributed cache plus a userspace page cache replaced node-local caching, and the Shared Catalog replaced the Atomic and Replicated database engines. Centralized metadata enables fast bootstrapping without warm-up and DROP operations that don't require every node to be online. It also adds new DDL such as atomic INSERT … SELECT, cross-database RENAME and UNDROP, with selective invalidation of conflicting DDLs instead of a global lock, and extends stateless compute to Iceberg and Delta Lake.
- Building Real-time Analytics Apps with ClickHouse and Hex
ClickHouse mediumAdept
ClickHouse's git-import tool was run across the 50k most-starred GitHub repositories using a queue-worker model, with the job queue implemented as a KeeperMap table instead of an external queue like SQS. New keeper_map_strict_mode settings make inserts unique per primary key and turn ALTER updates and deletes into atomic version-checked operations, so a worker can claim a job exclusively. All repositories share three ReplacingMergeTree tables keyed first on repo_name, with an updated_at materialized column used to schedule refreshes. On a 48-core machine with 25 workers, about 24 hours produced 44.7B line changes at a 14x compression ratio, which feed a Hex notebook app for real-time repository insights.