86 Star 469 Fork 273

GVPopenEuler / iSulad

 / 详情

优化isula rm 性能

已完成
任务
创建于  
2022-01-13 17:47

container_delete_cb时间统计:
输入图片说明
继续分解耗时长的函数container_destroy:
输入图片说明
打点发现该接口耗时,原因是这个地方做了遍历,在运行到 zfs 的时候还会起一个进程,导致一个大约6毫秒的耗时:
输入图片说明

实际对我的镜像而言,这个遍历没有任何作用,测试下来,下面数组中的任何一个回调都没执行,请确认该if (bdevs[i].ops->detect(path))操作是否为有效操作?是否可以删除以优化性能?!
static const struct lxc_storage_type bdevs[] = {
{ .name = "dir", .ops = &dir_ops, },
{ .name = "zfs", .ops = &zfs_ops, },
{ .name = "lvm", .ops = &lvm_ops, },
{ .name = "rbd", .ops = &rbd_ops, },
{ .name = "btrfs", .ops = &btrfs_ops, },
{ .name = "overlay", .ops = &ovl_ops, },
{ .name = "overlayfs", .ops = &ovl_ops, },
{ .name = "loop", .ops = &loop_ops, },
{ .name = "nbd", .ops = &nbd_ops, },
#ifdef HAVE_ISULAD
//isulad: block device
{ .name = "blk", .ops = &blk_ops, }
#endif
};

评论 (3)

firstadream 创建了任务

Hi firstadream, 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: iSulad, and any of the maintainers: @haomintsai , @lifeng_isula , @haozi007 , @jingxiaolu

openeuler-ci-bot 添加了
 
sig/iSulad
标签
firstadream 修改了描述
firstadream 修改了描述

我们镜像默认应该是dir_detect会退出,但是由于进行lxc-destory的时候,镜像的merged目录已经删除了,导致dir_detect失效,从而遍历了所有的bdevs。

bool dir_detect(const char *path)
{
	struct stat statbuf;
	int ret;

	if (!strncmp(path, "dir:", 4))
		return true;

	ret = stat(path, &statbuf);
	if (ret == -1 && errno == EPERM)
		return log_error_errno(false, errno, "dir_detect: failed to look at \"%s\"", path);

	if (ret == 0 && S_ISDIR(statbuf.st_mode))
		return true;

	return false;
}

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
5329419 openeuler ci bot 1632792936 5595769 duguhaotian 1605235330
C
1
https://gitee.com/openeuler/iSulad.git
git@gitee.com:openeuler/iSulad.git
openeuler
iSulad
iSulad

搜索帮助