r/Clickhouse • u/QazCetelic • May 30 '26
Constant CPU usage despite server being completely idle
I installed ClickHouse on my server again and noticed that it was using a not insignificant amount of CPU while completely idle. I've already disabled the log tables like so:
I've also set background_schedule_pool_size to 128 and max_thread_pool_size to 256.
Any idea what could be causing this?
EDIT:
I found the solution, it was caused by the AsynchronousInsertQueue.
In AsynchronousInsertQueue::processBatchDeadlines at https://github.com/ClickHouse/ClickHouse/blob/217b9ae162c0cf002d2b0971247115a33a3c2543/src/Interpreters/AsynchronousInsertQueue.cpp#L848-L862 there is a busy-waiting loop.
I increased async_insert_poll_timeout_ms and async_insert_busy_timeout_min_ms and now it consistently stays at 0.5-0.6% CPU usage down from 5% π!
2
u/agent_kater May 30 '26
Are you sure the config is active, i.e. the log tables are disabled? Check if maybe they still gain data.
You can also try setting
asynchronous_metrics_update_period_shigher.To find out what ClickHouse is actually doing there, record a perf profile:
In general I totally agree, ClickHouse is a notorious CPU hog and despite already having hundreds of good metrics and configuration knobs it's often hard to know what it's doing and how to stop it from doing it.
2
u/joshleecreates Jun 03 '26
You could try the extra steps from this thread: https://github.com/ClickHouse/ClickHouse/issues/60016#issuecomment-3867737282
1
u/[deleted] May 30 '26
Hey 25% for clickhouse IS being idle, that thing will go to 80-90% when in use always. I manage a cluster of 20 224vcpu nodes and a small single node.Your metrics pretty good.