我在 Linux Fedora Core 11 机器上看到了一些 PHP 脚本的性能问题,所以我运行了一些命令来寻找瓶颈。我注意到的一件事是编写文件非常快:
[root@localhost ~]# dd if=/dev/zero of=/root/myGfile bs=1024K count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 1.0817 s, 969 MB/s
但是覆盖它需要更长的时间;
[root@localhost ~]# dd if=/dev/zero of=/root/myGfile bs=1024K count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 23.0658 s, 45.5 MB/s
这是为什么?(我可以重复这些结果。)