titan icon indicating copy to clipboard operation
titan copied to clipboard

not hold mutex when destruct big object

Open dongdaoguang opened this issue 4 years ago • 6 comments

Signed-off-by: jason [email protected] 我们线上使用titan的时候经常发现get会产生几百毫秒延时,原因是get命令创建snapshot的时候会mutex_.Lock()。但BlobGCJob对象在析构的时候会持有mutex_,该对象中保存了需要回写sst中的kv,如果需要回写的kv很多(线下测试可能会有几十万条),那么该对象会很大,析构的时候比较耗时,持有mutex_的时间就会比较长,导致get命令加锁被阻塞。所以建议析构大对象的时候,不要持有锁。我们修复后,线上已经跑了一个月,get已经不会产生延时抖动。

优化前:一天get超过200ms延时大概在10w条左右 优化后:一天get超过200ms延时大概在100条左右

dongdaoguang avatar Jun 30 '20 12:06 dongdaoguang

And do you mind update the PR summary using English?

yiwu-arbug avatar Jun 30 '20 21:06 yiwu-arbug

You can install clang-format and clang-format-diff and run scripts/format-diff.sh once to fix CI.

yiwu-arbug avatar Jun 30 '20 21:06 yiwu-arbug

We use titan for PIKA whitch is a persistent huge storage service.

dongdaoguang avatar Jul 01 '20 01:07 dongdaoguang

@dongdaoguang friendly ping

Connor1996 avatar Jul 07 '20 02:07 Connor1996

/run-tests

yiwu-arbug avatar Jul 29 '21 02:07 yiwu-arbug

/run-tests

yiwu-arbug avatar Jul 29 '21 03:07 yiwu-arbug