We observed many txn conflicts between write and compact when using TiKV, especially when users have many small IOs. TiKV's txn conflicts are very expensive, we can avoid them on the client side by using inode-granularity locks.
One downside of this change is that compaction between chunks within an inode cannot be performed concurrently, but considering chunks are 64M, so the probability of small IOs spanning multiple chunks is relatively low.
We observed many txn conflicts between
write
andcompact
when using TiKV, especially when users have many small IOs. TiKV's txn conflicts are very expensive, we can avoid them on the client side by using inode-granularity locks. One downside of this change is that compaction between chunks within an inode cannot be performed concurrently, but considering chunks are 64M, so the probability of small IOs spanning multiple chunks is relatively low.