Skip to content

Link libumem to clickhouse#22

Merged
wfchandler merged 1 commit intomasterfrom
wc/ch-libumem
May 5, 2025
Merged

Link libumem to clickhouse#22
wfchandler merged 1 commit intomasterfrom
wc/ch-libumem

Conversation

@wfchandler
Copy link
Copy Markdown
Contributor

Clickhouse heavily contends the system allocator's global lock. Link it with libumem to mitigate this.

Fixes oxidecomputer/omicron#7716

Clickhouse heavily contends the system allocator's global lock. Link it
with `libumem` to mitigate this.

Fixes oxidecomputer/omicron#7716
@wfchandler wfchandler requested review from bnaecker and jclulow May 1, 2025 17:29
Copy link
Copy Markdown
Contributor

@bnaecker bnaecker left a comment

Choose a reason for hiding this comment

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

Seems fine to me! Just so I understand, this is not to let us swap out libc / umem / jemalloc, but to always pick up the umem-provided allocation symbols, is that right?

@wfchandler
Copy link
Copy Markdown
Contributor Author

Seems fine to me! Just so I understand, this is not to let us swap out libc / umem / jemalloc, but to always pick up the umem-provided allocation symbols, is that right?

That's correct. The jemalloc clickhouse bundles doesn't build on Illumos, and given the performance difference with libc I didn't think we'd ever not want to use umem.

@bnaecker
Copy link
Copy Markdown
Contributor

bnaecker commented May 1, 2025

I agree we probably want to always use libumem. We can figure out how to get jemalloc building later, if / when that becomes relevant. Thanks!

@rmustacc
Copy link
Copy Markdown

rmustacc commented May 1, 2025

Seems fine to me! Just so I understand, this is not to let us swap out libc / umem / jemalloc, but to always pick up the umem-provided allocation symbols, is that right?

Specifically the malloc, free, calloc, and related symbols in libc are marked interposable in the libc mapfile to bypass direct binding (the NODIRECT flag), see malloc() here. By placing -lumem on the line, when the run-time link-editor runs and performs relocations for these symbols, the umem copy of the malloc, free, etc. symbols will end up being used in lieu of those in libc. As clickhouse specifically undoes any LD_PRELOAD methods of changing this, linking it directly is necessary.

@wfchandler wfchandler merged commit 11f32ad into master May 5, 2025
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.

OxQL slows down a lot when multiple queries run concurrently

4 participants