在docker容器中创建硬链接需要很长时间

时间:2018-01-19 19:01:15

标签: performance docker hardlink

我使用以下命令在docker容器中创建目录中的所有文件的硬链接(大约500MB):

cp -al source destination

有趣的是,当我第一次发出上述命令时(即当该目录中的每个文件没有硬链接时),需要相当长的时间。当我再次发出上述命令以在其他目标中创建相同文件的硬链接时,情况并非如此。当我在我的docker主机中执行此操作时也不是这种情况(即使它是第一个正在创建的硬链接)。

我的docker容器使用overlay2作为存储驱动程序。这是我的docker info输出

Containers: 61
 Running: 1
 Paused: 0
 Stopped: 60
Images: 142
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: journald
Cgroup Driver: systemd
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Authorization: rhel-push-plugin
Swarm: inactive
Runtimes: runc oci
Default Runtime: oci
Init Binary: /usr/libexec/docker/docker-init-current
containerd version: fbadd789ddf86a4be9d6905528b7486c61e52612 (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: fbadd789ddf86a4be9d6905528b7486c61e52612-dirty (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  WARNING: You're not using the default seccomp profile
  Profile: /etc/docker/seccomp.json
 selinux
Kernel Version: 4.14.13-300.fc27.x86_64
Operating System: Fedora 27 (Workstation Edition)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 8
Total Memory: 15.58 GiB
Name: pranavk.local.me
ID: STYG:PZCA:FMHL:FLCU:N7VG:Z463:KYQF:QVHO:KWKP:FHTY:EUBA:QBUK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Registries: docker.io (secure), registry.fedoraproject.org (secure), registry.access.redhat.com (secure), docker.io (secure)

编辑: 如果我删除所有硬链接然后再次发出上面的cp命令,那么它会再次快速。呼!

我不确定导致这种情况的原因是什么,或者我应该从哪里开始寻找。

0 个答案:

没有答案