The directIndex used by the TSMWriter maintained a map of series keys to index entries. When the index is written to the TSM file, the keys are sorted and then written out in order. The reason for this is because directIndex used to be the only index and it was optimized more for reading. The reading has been replaced by the indirectIndex so the map of keys ends up wasting space. During compactions, the series keys (and index entries) are already sorted so this change uses the sorting to avoid the map and sort when writing the index. This reduces allocations and CPU usage quite a bit for larger cardinality TSM files. |
||
---|---|---|
.. | ||
tsm1 | ||
engine.go |