Rust 程序在多台服务器上共享用户时调用服务器的速度大幅下降

Rust 程序在多台服务器上共享用户时调用服务器的速度大幅下降

Rust 程序(如 ripgrep、fd、rustc、cargo)在实际代码运行之前就停滞了。

运行strace <program>显示系统在某个openat时刻阻塞/home

...
statx(AT_FDCWD, "/home/<user>/.rustup", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=7, ...}) = 0
getcwd("/home/<user>", 512)            = 14
statx(AT_FDCWD, "/home/<user>", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, stx_mode=S_IFDIR|0700, stx_size=18, ...}) = 0
lstat("/home", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
lstat("/home/<user>", {st_mode=S_IFDIR|0700, st_size=18, ...}) = 0
openat(AT_FDCWD, "/home/<user>/rust-toolchain", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/<user>/rust-toolchain.toml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, "/home", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, stx_mode=S_IFDIR|0755, stx_size=0, ...}) = 0
lstat("/home", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
openat(AT_FDCWD, "/home/rust-toolchain", O_RDONLY|O_CLOEXEC

但最终无法打开该不存在的文件并继续在其他地方搜索(这次没有减速)并最终成功。

openat(AT_FDCWD, "/home/rust-toolchain.toml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, "/", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
openat(AT_FDCWD, "/rust-toolchain", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/rust-toolchain.toml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, "/home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=7, ...}) = 0
...

我不知道它为什么会在那里寻找这样的配置文件。速度变慢可能是由于工作中的奇怪设置,我们的家通过 ssh 同时在多个 debian 服务器上可用。此外,我们显然没有 root 访问权限。

我如何才能阻止该文件检查?这真的是问题吗?

相关内容