磁盘占用很严重,如何优化?(Compaction 限流)

提问:磁盘占用很严重,磁盘清理文件的速度远远跟不上写的速度,调整了 BookKeeper 参数 gcWaitTime、majorCompactionInterval、minorCompactionInterval 效果不明显,是否还有其他解决方案?

解答:Compaction 有一个限流策略,从你的描述来看,应该是 compaction 比较慢,可以调整isThrottleByBytes=true,并且增加compactionRateByBytes的限流阈值。

#Throttle compaction by bytes or by entries.
isThrottleByBytes=false

#Set the rate at which compaction will readd entries. The unit is adds per second.
compactionRateByEntries=1000

#Set the rate at which compaction will readd entries. The unit is bytes added per second.
compactionRateByBytes=1000000