上游社区已修正此问题:
https://github.com/ceph/ceph/pull/39057/files
【标题描述】我们在ceph client端的测试中发现adjust_count热点占40%,注释后性能大幅提升
【问题复现步骤】
操作步骤:SPDK启动拉起ceph虚拟盘,在虚拟机里使用fio测试虚拟盘的IO性能,在host上perf抓取vhost进程的热点,发现 adjust_count占比非常高。
adjust_count代码:
//src/include/mempool.h
shard_t* pick_a_shard() {
// Dirt cheap, see:
// http://fossies.org/dox/glibc-2.24/pthread__self_8c_source.html
size_t me = (size_t)pthread_self();
size_t i = (me >> 3) & ((1 << num_shard_bits) - 1);
return &shard[i];
}
//src/common/mempool.cc
void mempool::pool_t::adjust_count(ssize_t items, ssize_t bytes)
{
shard_t *shard = pick_a_shard();
shard->items += items;
shard->bytes += bytes;
}
其中问题主要在pick_a_shard函数中,它先获取me = pthread_self(),然后me右移3bit取低5bit作为shard数组下标,这里pthread_self()返回的是线程在进程内的唯一标识ID,这里vhost进程内所有线程获取的id低12bit都是一致的(4K page对齐),所以vhost里所有线程都选中了相同的shard,多线程间产生大量的原子写竞争。
复现概率:必现
出现问题时的perf top截图:
Hi liqiang9102, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-ceph, and any of the maintainers: @chixinze , @liuzhiqiang
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
感谢提出该问题。
欢迎提pr来解决该问题
登录 后才可以发表评论