performance_schema.CLUSTER_DISK_USAGE_INFO 的统计走的是系统调用,通过系统函数 statfs 统计空间容量,而不是 du 命令。 执行步骤是: (1)查询 CLUSTER_DISK_USAGE_INFO 首先是将命令下发到各个节点,查询各个节点的 performance_schema.DISK_USAGE_INFO 表,然后向 gcluster 层汇总 (2)performance_schema.DISK_USAGE_INFO 表信息通过系统命令 statfs 统计 系统表 performance_schema.CLUSTER_DISK_USAGE 确认 SIZE 、USED、AVAIL 几列走的是 statfs 系统调用。 DIR_SIZE 列走的是 lstat 调用,会排查每个文件的大小,在表多、列多的场景下效率较慢。 strace -tT -f -e trace=fstat -o du.log du /opt/gnode/userdata/gbase/ strace -tT -f -e trace=fstat,lstat,statfs du /opt/gnode/userdata/gbase/ strace -tT -f -e trace=lstat -p pidof gbased strace -tT -f -o 1.txt -e trace=lstat -p pidof gbased strace -tT -f -o 2.txt -e trace=newfstatat du /opt/gnode/userdata/gbase/
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




