Skip to content

Add optional backend for ClickHouse storage#6194

Merged
thorfour merged 7 commits intoparca-dev:mainfrom
danipozo:danipozo/clickhouse-backend
Feb 23, 2026
Merged

Add optional backend for ClickHouse storage#6194
thorfour merged 7 commits intoparca-dev:mainfrom
danipozo:danipozo/clickhouse-backend

Conversation

@danipozo
Copy link
Contributor

@danipozo danipozo commented Feb 6, 2026

Adds an optional flag to enable storage of traces in a ClickHouse server. This enables better scalability for users who wish to ingest and query data from many nodes, as the current FrostDB storage struggles with heavy use cases.

This introduces a new module implementing the same public interface as the parcacol module, based on FrostDB, and initializes the selected backend depending on the flag. Traces are inserted into and queried from a MergeTree table, the basic engine in ClickHouse. This could be modified to be a ReplicatedMergeTree to enable more complex setups. For the labels, it uses a column with the JSON type, which stores most frequent labels in separate columns for query efficiency (this was a design objective of FrostDB AFAIK).

Caveats

  1. The ingester assumes that every location from the profile contains only one line, as I've only seen that case and I'm not sure the extra complexity is worth introducing right now. For addresses with inlined functions in native binaries, they are ingested as one line unsymbolized and then the inlined functions are extracted by the symbolizer.
  2. I haven't reviewed in depth the code that actually generates flamegraph structures, as it may be worth to push that computation to ClickHouse too, but I think it would be too much scope for this PR anyway.

Add a new optional storage backend backed by a ClickHouse database. This
should improve performance over the FrostDB backend and help users send
data from more nodes and query it efficiently.

This commit is the first working version of the code, improvements will
follow in later commits.
- move Symbolizer interface to the symbolizer module
- remove deduplication and ordering of results on the Go side, relying
  on the database instead
- in QueryRange, move grouping by labels to ClickHouse
- in QuerySingle and QueryMerge, match FrostDB aggregation behavior
- remove dead code
- formatting
The function was moved to that module so it makes sense for the test to
be there too.

Remove test that only checked constants had specific values.
@danipozo danipozo requested review from a team as code owners February 6, 2026 17:13
@danipozo
Copy link
Contributor Author

danipozo commented Feb 6, 2026

cc @thorfour @umanwizard

@thorfour
Copy link
Contributor

thorfour commented Feb 6, 2026

cc @thorfour @umanwizard

Awesome! Thanks for this. Will review it next week

@danipozo danipozo requested a review from a team as a code owner February 6, 2026 17:45
@danipozo danipozo force-pushed the danipozo/clickhouse-backend branch from 213a51a to 597c762 Compare February 6, 2026 20:42
@thorfour
Copy link
Contributor

thorfour commented Feb 9, 2026

This looks great! Thanks for the contribution.

I would like to mark this as an experimental feature for now. As such can we move the clickhouse flags into the FlagsHidden struct so that they aren't not displayed in --help by default?

Hide them by default as it's an experimental feature
@danipozo
Copy link
Contributor Author

danipozo commented Feb 9, 2026

Sure! Done in the latest commit

@danipozo
Copy link
Contributor Author

Hey, kindly pinging, if you get a chance to take another look 👀

Copy link
Contributor

@thorfour thorfour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@thorfour thorfour merged commit fa35703 into parca-dev:main Feb 23, 2026
32 of 34 checks passed
@brancz
Copy link
Member

brancz commented Feb 23, 2026

I just wanted to point out, this is experimental and hidden, there is a possible future where we might do a major overhaul of Parca, and it's possible that in an effort like that this type of feature may be dropped. Nevertheless, we want to enable users in the meantime to do what they would like, but there is no guarantee for the longevity of this feature.

@danipozo
Copy link
Contributor Author

there is a possible future where we might do a major overhaul of Parca

It would be interesting to know more about this, do you have some kind of public roadmap?

@brancz
Copy link
Member

brancz commented Feb 24, 2026

There isn't anything public yet since we haven't fully made up our mind, but our internal systems at Polar Signals have dramatically diverged from Parca to the point where Parca maintenance has suffered since we are maintaining effectively two projects that achieve much of the same things (hence why we're ok with merging things like this even though it's very far from our original goal of having a single statically linked binary akin to Prometheus for profiling).

An idea has emerged that maybe we will be open-sourcing some of the work we've done at Polar Signals, but that would mean very dramatic changes in Parca, since we've practically fully moved to rust at Polar Signals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants