Large File Deletion Comparison

Test bed:

Kernel: 2.6.21-rc7
Partition size: 2 TB (sde)

Tests are done on a bi-Xeon machine with 2G of RAM and with hyper-threading enabled (4 CPUs).

processor      : 4
vendor_id      : GenuineIntel
cpu family     : 15
model          : 4
model name     : Intel(R) Xeon(TM) CPU 2.80GHz
cpu MHz        : 2793.078
cache size     : 1024 KB
bogomips       : 5586.59

# hdparm -t /dev/sde

/dev/sde:
 Timing buffered disk reads:  318 MB in  3.01 seconds = 105.62 MB/sec

Scripts

The test sequence is:
#ext3
mkfs.ext3  /dev/sde
mount -t ext3 /dev/sde /mnt/test
##  create a 100 GB file
dd if=/dev/zero of=/mnt/test/foo bs=1048576 count=100000
sync
##  get file fragmentation
filefrag /mnt/test/foo
##  flush caches by unmounting/mounting FS
umount /mnt/test
mount -t ext3 /dev/sde /mnt/test

iostat | grep sde
##   measure time of file deletion and fs syncing
time sh -c "rm /mnt/test/foo && sync"
iostat |g rep sde
umount /mnt/test

#ext4
mkfs.ext3 /dev/sde
mount -t ext4dev -o extents /dev/sde /mnt/test
##  create a 100 GB file
dd if=/dev/zero of=/mnt/test/foo bs=1048576 count=100000
sync
##  get file fragmentation
filefrag /mnt/test/foo
##  flush caches by unmounting/mounting FS
umount /mnt/test
mount -t ext4dev -o extents /dev/sde /mnt/test

iostat | grep sde
##   measure time of file deletion and fs syncing
time sh -c "rm /mnt/test/foo && sync"
iostat | grep sde
umount /mnt/test

#xfs
mkfs -t xfs /dev/sde
mount -t xfs /dev/sde /mnt/test
##  create a 100 GB file
dd if=/dev/zero of=/mnt/test/foo bs=1048576 count=100000
sync
##  get file fragmentation
xfs_bmap /mnt/test/foo
##  flush caches by unmounting/mounting FS
sudo umount /mnt/test
sudo mount -t xfs /dev/sde /mnt/test

iostat | grep sde
##   measure time of file deletion and fs syncing
time sh -c "rm /mnt/test/foo && sync"
iostat |g rep sde
umount /mnt/test


Filesystems and options are:


filesystems mount options
1
ext3 defaults
2
ext4
extents
3
xfs
defaults


The values collected are:


Results

The first table shows the results obtained with a not very fragmented file and the second table the results obtained with a more fragmented file.


       ext3   
  ext4+extents 
    xfs      
number of fragments
796
798
15
elapsed time
(user + sys)
2m0.306s
 (0.000s + 6.444s)
0m11.127s
 (0.000s + 5.592s)
0m0.553s
 (0.004s + 0.004s)
number of blocks read
206600
6416
352
   number of blocks written  
13592
13064
104




       ext3   
  ext4+extents 
    xfs      
number of fragments
20297
19841
234
elapsed time
(user + sys)
2m18.914s
 (0.000s + 6.516s)
0m27.429s
 (0.000s + 5.676s)
0m0.892s
 (0.008s + 0.004s)
number of blocks read
225624
25432
592
   number of blocks written  
52120
50664
872