[ale] why would it take longer to delete a file than to create it?

Björn Gustafsson bg-ale at bjorng.net
Tue May 4 18:46:09 EDT 2010


My guess is that the file is syncing during the delete, so you have to
wait for all the blocks to be written to disk before the file can be
removed.  Also, you may be swapping, depending on how much memory you
have.

On ext3 I got similar times (10 sec to write; 15 sec to delete). If I
add a sync in the middle then the rm time goes down to 0.5 sec.

date; time dd if=/dev/zero  of=zero.txt bs=1024 count=1000000; date;
time sync; date;time rm zero.txt ;date


On Tue, May 4, 2010 at 6:29 PM, John G. Heim <jheim at math.wisc.edu> wrote:
>
> I have this very slow database server. Today I noticed something strange
> about it. I can create a large file via dd faster than I can delete it.
> Look at the screen cap below... It took just 12 seconds to create the file
> with a million 1K records but it took 36 seconds to delete it. Why would
> that be? I'm running debian lenny with a 2.6.30 kernel. There are 2 500 Gb
> disks in the machine configured as RAID-1.  The file system on the disk is
> ext3.
>
> # date; dd if=/dev/zero  of=zero.txt bs=1024 count=1000000; date; rm
> zero.txt; date
> Tue May  4 16:59:21 CDT 2010
> 1000000+0 records in
> 1000000+0 records out
> 1024000000 bytes (1.0 GB) copied, 11.7291 s, 87.3 MB/s
> Tue May  4 16:59:33 CDT 2010
> Tue May  4 17:00:09 CDT 2010

-- 
Björn Gustafsson



More information about the Ale mailing list