Skip to content

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

ClickHouse 22 min read Case study hardMaster

Optimizing ClickHouse for Intel's ultra-high core count processors

Intel engineers profiled all 43 ClickBench queries on 160–480 vCPU Xeon systems and landed a series of ClickHouse optimizations targeting lock contention, memory management and other scaling bottlenecks. Examples include double-checked locking with shared locks in the query condition cache (spinlock time cut from 76% to 1%, Q10/Q11 up ~85–89%), thread-local profiler timers, and raising jemalloc's lg_extent_max_active_fit to 8 to match two-level hash table reuse (Q35 up 96%, page faults down 71%). Individual fixes gave up to 10x on single queries and 2–10% geomean gains each, all merged upstream.

Related posts

  • Running ClickHouse on NVIDIA Vera CPU: Is your favorite database up to the challenge?

    ClickHouse mediumAdept

    ClickHouse, run unmodified on NVIDIA's early-access Vera CPU (2×88 Arm Olympus cores, 352 SMT threads, ~1.2 TB/s memory bandwidth), topped the ClickBench hardware leaderboard. Micro-benchmarks on a 1 TB in-memory table show near-linear scaling for CPU-bound filters, low-cardinality aggregation and parallel hash joins up to the 176 physical cores, with efficiency dropping beyond that as SMT threads give only modest gains. A simple LIKE filter becomes memory-bound at ~64 threads (~813–900 GB/s). Disabling auto-vectorization on a comparison loop made a single-threaded filter 3.5x slower, showing the value of NEON SIMD, with SVE2 support in progress.

  • ClickHouse Cloud on Google Cloud Now Powered by Google Axion Processors: 30–55% Faster Queries, ~15% Fewer Compute Credits

    ClickHouse easyNovice

    ClickHouse Cloud is migrating its Google Cloud fleet from x86 N2D instances to Arm-based Axion C4A instances, yielding 30–55% faster queries across all 43 ClickBench queries, roughly halved load times, and first place on the combined ClickBench ranking. Across a controlled cohort of 38 production services, compute credits per query fell about 15%, with larger gains for CPU-bound workloads and smaller ones where GCS read throughput dominates. The rollout went from staging to region-by-region migration, gated on SharedCatalog storage, maintenance windows and traffic tier, with the highest-traffic organizations moved last. Contributing factors cited include steadier clock frequency under sustained load and one physical core per vCPU instead of two hyperthreads.

  • How ClickHouse became fast at joins

    ClickHouse hardMaster

    ClickHouse became 26× faster on the join-heavy TPC-H SF100 workload between 22.4 and 26.4. In the first year (4.4×) parallel hash join became the default, build and probe phases were optimized and two-table reordering was added. In the second year (another 6× with default settings) four changes landed: decorrelation of correlated subqueries, lazy column replication, runtime filters and statistics-based join reordering. Lazy replication represents repeated join outputs as dictionary indexes instead of copying wide strings (1.9× faster in a self-join benchmark). Runtime bloom/min-max filters built from build-side keys are applied as PREWHERE on the probe side (2.1× faster, peak memory cut from 1.24 GiB to 185 MiB).

  • Announcing Silk: a silky smooth fiber runtime for ClickHouse

    ClickHouse hardMaster

    Silk is a C++ stackful-fiber runtime for ClickHouse. It pins one scheduler thread per CPU, uses io_uring as its I/O foundation, steals work in order of CPU topology cost (hyperthread sibling, then same socket, then cross-socket), and does zero heap allocation in the steady-state hot path through mmap'd stack pools, stack-resident futures and intrusive containers. Its benchmarks report about 3.6 ns per yield, 5.9M file IOPS and roughly 4-15x boost::asio throughput, and it argues that Photon's cache-aliasing penalty comes from slab-allocated stacks rather than from stackful fibers. The tradeoffs are that it runs only on Linux, uses a process-wide singleton scheduler and caps fiber parameters at 64 bytes. Its first target is ClickHouse's distributed cache, where internal tests showed about 65% better p99.9 latency than a thread pool.

  • Parallelizing ClickHouse aggregation merge for fixed hash map

    ClickHouse hardMaster

    ClickHouse 25.11 parallelizes the merge phase for GROUP BY on 8- and 16-bit keys, which use an array-backed FixedHashMap. Before this, these aggregations could not use the bucket-wise parallel merge available to two-level hash tables, so a UInt16 key query ran in 62.8s versus 8.5s for the same query cast to UInt64. The fix has merge threads work in place on disjoint key subsets instead of converting to a two-level table. Along the way: contiguous range segmentation balanced poorly, a shared non-thread-safe Arena caused memory corruption and needed one Arena per thread, and a fixed 3ms regression on trivial aggregates was solved by computing the min/max populated index before the parallel merge.

The quest for software engineering knowledge.

Look:
Layout: