Ubuntu - File Copy Seems Resource Intensive

Scott J. Henson scotth at csee.wvu.edu
Mon Jul 17 19:33:20 UTC 2006


Gregory PiƱero wrote:
> Hi guys,
> 
> I just started copying about 5GB between two partitions using Nautilus
> in freshly installed 6.06 (first time doing this) and now that the
> copy is going, anything else I try to do takes an extremely long time.
> e.g. 2+ minutes to open Firefox, etc.  Is this normal?  Is there
> something I should change?
> 

Two things are happening here.  The first is that the Linux 
kernel is a cache aggressive kernel. What that means is that 
it will try to use as much of your ram as it can to cache 
stuff that it has read or written to disk.  It leaves some 
ram to fulfill immediate memory allocations, but if you want 
a big chunk of memory your going to have to wait for the 
kernel to clear some dirty pages.  Normally for cached pages 
associated with a read, it just has to clean the pages and 
hand them over.  But, for a write it has to flush those 
pages to disk.  So, when firefox starts up it wants to 
allocate a bunch of ram, and thus it has to wait for the 
kernel to free some ram.  Since your copying a file there 
are a lot of both read cache and write cache pages.

The second thing that is going on is that in order to start 
firefox you must read its binary, libraries, and users data 
from the same disk that your using in your copying.  There 
is only so much bandwidth to and from your disk and the 
kernel io scheduler (or elevator) tries to allocate that 
bandwidth fairly between your two processes.  Normally this 
is good, but in your case you care more about the firefox 
process starting up than you do the copy finishing. 
Currently I know of no way to let the kernel know this. 
There used to be some talk of modular, switchable elevators, 
but I don't know what happened to it.

Between the two problems above, the second is the worse of 
the two, since it also contributes to the first.  As far as 
I know the only solution is faster disks(SATAII and 15K RPM) 
and more/faster RAM(DDR2 and 1GB or more).  Obviously this 
can be prohibitively expensive.

Another solution is to start firefox before you copy large 
files.  That or use rsync with the --bwlimit switch.  That 
probably the better solution because you can limit rsync to 
5000kb/s and still have useable bandwidth for everything 
else.  That would be the proper solution if your going to be 
doing a lot of copying of large files around.  You can even 
put the following in your .bashrc to make it nice and easy 
to use.

alias cp='rsync --bwlimit=5000 '

You will have to play around with the 5000 till you get a 
good number that leaves your system usable.  Like I said 
though, this would be something you would do if your doing 
this copying of large files often.  Also this wouldn't work 
for nautilus so you would have to copy those large files 
from the command line.


Also, you may not be running the optimized kernel for your 
processors.  IO can be slow and more processor intensive on 
the 386 kernel.  If you are running an Intel PII or above, 
you should run the 686 kernel(sudo apt-get install 
linux-686) and if your running on an athlon then you should 
install the k7 kernel(sudo apt-get install linux-k7).

Wow that post was longer than I thought it would be.

-- 
Scott Henson
LCSEE Systems Staff
WVU MAE Undergraduate
Ubuntu User





More information about the ubuntu-users mailing list