Hello all,

I've recently upgraded to Cassandra 4.1 and see a change in compaction behavior 
that seems unwanted:

* With Cassandra 3.11 compaction was run by thread in low priority and thus 
using CPU nice (visible using top) (I believe Cassandra 4.0 also had this 
behavior)

* With Cassandra 4.1, compactions are no longer run as low priority thread 
(compaction now use "normal" CPU).

This means that when the server had limited CPU, Cassandra compaction now 
compete for the CPU with other process (probably including Cassandra itself) 
that need CPU. When it was using CPU nice, the compaction only competed for CPU 
with other lower priority process which was great as it leaves CPU available 
for processes that need to kept small response time (like an API used by human).

Is it wanted to lose this feature in Cassandra 4.1 or was it just a forget 
during re-write of compaction executor ? Should I open a bug to re-introduce 
this feature in Cassandra ?


I've done few searches, and:

* I believe compaction used CPU nice because the compactor executor was created 
with minimal priority: 
https://github.com/apache/cassandra/blob/cassandra-3.11.16/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L1906

* I think it was dropped by commit 
https://github.com/apache/cassandra/commit/be1f050bc8c0cd695a42952e3fc84625ad48d83a

* It looks doable to set the thread priority with new executor, I think adding 
".withThreadPriority(Thread.MIN_PRIORITY)" when using executorFactory in 
https://github.com/apache/cassandra/blob/77a3e0e818df3cce45a974ecc977ad61bdcace47/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L2028
 should do it.


Did I miss a reason to no longer use low priority threads for compaction ? 
Should I open a bug for re-adding this feature / submit a PR ?

Regards,

Pierre Fersing

Reply via email to