clickhouse-docs icon indicating copy to clipboard operation
clickhouse-docs copied to clipboard

Clarify what linux version should have THP set to madvise

Open nicksherron opened this issue 1 year ago • 4 comments

Hello, tips.md mentions that THP can cause significant performance degradation but updating to madvise is only necessary if using using old Linux kernel. Can we be more specific? What is old? Otherwise, how does one know whether to update /sys/kernel/mm/transparent_hugepage/enabled or not?

P.S Thanks for blessing the world with clickhouse, you all are awesome.

nicksherron avatar Oct 03 '24 22:10 nicksherron

I also have same problem. I didn't found code about madvise mem to huge page, just wonder if it works now?

qhsong avatar Oct 11 '24 06:10 qhsong

https://github.com/ClickHouse/ClickHouse/commit/60054d177c8bc190e8187c7c5f5e8495a1957a04 this commit delete madvise from allocator and ClickHouse/ClickHouse#14685 add hugepage for text segment as an experimental feature, it not turn on in production env. so maybe turn off hugepage is ok in production env?

qhsong avatar Oct 11 '24 07:10 qhsong

That note was about performance issues in Linux Kernels 3.2... With a lot of RAM (like 64GB+) and transparent_hugepage enabled you may experience long pauses, because Kernel may spend a lot of time on RAM defragmentation. With Kernels 5+ it's safe to use [always].

this commit delete madvise from allocator and https://github.com/ClickHouse/ClickHouse/pull/14685 add hugepage for text segment

That tips.md concern is about Linux page cache (page cache uses THP), not about memory directly allocated by Clickhouse-server.


Disclaimer: I want to clarify that I am just an ordinary person on the Internet. I have no connection or association with Clickhouse, Inc. or its development team. It is important to note that my opinion holds no value and should not be considered.

den-crane avatar Oct 11 '24 15:10 den-crane

That tips.md concern is about Linux page cache (page cache uses THP), not about memory directly allocated by Clickhouse-server.

Also add some public links about THP: From this presentations, we can get some clues. https://presentations.clickhouse.com/database_saturday_2020/#4

And server code now check kernel not use always for THP. https://github.com/ClickHouse/ClickHouse/blob/1c45f9f6bdb199cdb8ec90b2a9f3ea03dd4121cc/programs/server/Server.cpp#L534

qhsong avatar Oct 16 '24 01:10 qhsong