[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how can i limit system resources for a particular process? [solved]



hi,

thanks for the info, it's been really useful.

vitaminix: what you suggested helped, but as Todd sais it has more to do with memory than with CPU, i didn't actually have a clue where the bottleneck was.

Todd: what you suggested works great. I kept playing with bs and count parameters, combined with nice and now the system is quite responsive through the whole period of time in which dd is running.

Thank you all very much for the advice.



En/na Todd A. Jacobs ha escrit:
On Thu, Jul 02, 2009 at 04:26:14PM +0200, Jordi Moles Blanco wrote:

I would like to run dd and let it use, for example, only 10% of the
CPU  time or 30% of the total amount of memory. Is that possible?  I'm
not  looking for a "general" process limit for the whole system, only
for a  particular process.

Part of your question is about memory. AFAICT, the memory consumed by dd
is strictly a function of its block size, so just specify a blocksize
that fits within available RAM and doesn't cause filesystem writes to
block too long.

You might need to experiment a bit with this. For example, the following
are functionally equivalent in that they both create a 1GB file in /tmp,
but one of them may work better on your system than the other, depending
on a variety of hardware characteristics:

    dd if=/dev/zero of=/tmp/zeroes bs=1M   count=1000
    dd if=/dev/zero of=/tmp/zeroes bs=256k count=4000

As for the rest of your question, most utilities like nice or cpulimit
operate on CPU usage, but your problem sounds like it's actually disk
I/O. I'd recommend installing util-linux if it isn't already on your
system, and using the ionice utility with "idle" priority.

You can even combine this with nice, if you want. Thus:

    nice -n18 ionice -c3 dd if=/dev/zero of=/tmp/zeroes bs=1M count=1000

will probably take a longer time to complete, but your system should be
extremely responsive the whole time.



Reply to: