Building a Paste Service With ClickHouse
pastila.nl is a minimal paste service whose browser JavaScript sends INSERT and SELECT queries directly to an internet-facing ClickHouse instance. Content is addressed by a 128-bit SipHash plus a 32-bit locality-sensitive fingerprint built from the minimum hash of word shingles. Ordering the primary key by fingerprint keeps similar edits adjacent, so storing every keypress compresses to almost nothing. The schema relies on EPHEMERAL and MATERIALIZED columns and CHECK constraints for hash verification, size limits and entropy-based garbage rejection, and runs on a Replicated database with two-node ClickHouse Keeper across Frankfurt and Ohio behind Route53 geo DNS. The setup deliberately embraces anti-patterns, such as a two-node consensus cluster that loses write availability if either node fails.
Related posts
- Singapore Meetup Report: How ClickHouse Powers Ahrefs, the World's Most Active Web Crawler
ClickHouse easyNovice
Ahrefs moved its web-crawler and analytics storage from a custom system built on Quantcast File System plus Elasticsearch to ClickHouse in 2019. It now runs hundreds of self-hosted ClickHouse hosts with a geo-replicated main cluster, where replicas are dedicated to read-heavy or write-heavy work and tables hold trillions of rows. The team buffers inserts to cut merge work and uses FETCH/ATTACH to move parts between servers. Ahrefs also upstreamed mark compression, which splits marks into blocks with a custom compression scheme and removes mutexes, cutting mark-cache memory by 3-6x.
- How trip.com migrated from Elasticsearch and built a 50PB logging solution with ClickHouse
ClickHouse mediumAdept
Trip.com replaced its Elasticsearch-based centralized logging platform with ClickHouse after hitting stability, ingestion and cost limits at 4PB, and has since grown it toward 50PB. The migration used a ReplicatedMergeTree schema with daily partitions, ZSTD codecs, LowCardinality columns, tag key/value arrays and tokenbf_v1 bloom-filter indexes. Kibana was extended with custom ClickHouse panels, and scripts migrated 95% of dashboards automatically. The result was over 50% storage savings and queries 4–30x faster (P90 under 300ms). Further growth caused ZooKeeper-driven DDL timeouts, which led trip.com to split into multiple clusters and to evaluate ClickHouse Cloud with SharedMergeTree.
- Contentsquare Migration from Elasticsearch to ClickHouse
ClickHouse mediumAdept
Contentsquare replaced 14 Elasticsearch clusters with ClickHouse over a phased migration. They first built a new product on ClickHouse, then shadowed production queries endpoint by endpoint to compare results, then moved customers one at a time over six months with zero regressions. The result was 11x lower infrastructure cost, 10x better p99 latency, and longer query windows and retention. Key design pieces were a Kafka-fed ingestion service (clickin) that writes shard-aligned data in ClickHouse native format via clickhouse-local, and an AST-based query optimizer that propagates partition/sort-key conditions and distributed_group_by_no_merge, merges subqueries, and gave a 10x speedup on the slowest 5% of queries.
- Didi Migrates from Elasticsearch to ClickHouse for a new Generation Log Storage System
ClickHouse mediumAdept
Didi replaced Elasticsearch with ClickHouse for petabyte-per-day log and trace storage, cutting machine cost by 30% and speeding up queries about 4x on a 400+ node single-replica deployment peaking at 40 GB/s writes and ~200 QPS. A single Flink write pipeline feeds a Log cluster, and materialized views populate a physically isolated Trace cluster plus AggregatingMergeTree trace index tables, with cold data tiered to HDFS. Schema design rounds log time to the hour as the leading sort key, partitions by day, and moves unfiltered fields into Map columns to limit small files. Operational fixes covered per-table write-node allocation for low-traffic tables, Flink-side throttling, a native TCP Flink connector, and HDFS tiering changes that cut restart time from 1 hour to 1 minute.
- 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.