Slashdot Mirror


Nice Performance Tuning For UNIX

Professor writes "Be 'nice' to your computers and examine some general guidelines for tuning server performance. A computer is like an employee who does tasks for you -- it's a good idea to keep from overburdening them. Keep this from happening by using the UNIX 'nice' command."

12 of 206 comments (clear)

  1. Re:what about killall by LLuthor · · Score: 4, Informative
    Umm. You can't sigkill init on Linux (at least on moderately recent kernels). I am pretty sure that is also the case on BSD systems.

    Yep ...
    In arch/i386/kernel/signal.c [2.6.17-rc1-mm2]
    563 /*
    564 * Note that 'init' is a special process: it doesn't get signals it doesn't
    565 * want to handle. Thus you cannot kill init even with a SIGKILL even by
    566 * mistake.
    567 */
    568 static void fastcall do_signal(struct pt_regs *regs)
    --
    LL
  2. Worst. Advice. Ever. by V.+Mole · · Score: 3, Informative

    Ah, yes, the extremely bad idea of running updatedb at low priority surfaces again. Then, instead of finishing during the early morning hours, it lasts all day, interferring with real work. Yes, this is what really happens: we tried this quite a while ago in Debian, and it's a Bad Idea(tm). What happens, IIRC, is that updatedb gets CPU so rarely that other tasks end up flushing the file buffers, and updatedb has to re-read the disk, over and over.

    If the problem is that your system isn't on all the time, and anacron is running updatedb when you log in, then just disable updatedb. You probably never use 'locate' anyway.

    1. Re:Worst. Advice. Ever. by gowen · · Score: 4, Informative
      Then, instead of finishing during the early morning hours, it lasts all day, interferring with real work.
      If there are no other processes competing for resources, niced and non-niced processes will complete in approximately the same time. If your niced late-night updatedb is taking forever, its because you've chosen to run other processes overnight as well. And if your updatedb runs quickly, then the other processes will "interfere with real work".

      In short : nice doesn't change the total amount of time your processes take (or, at least, not by very much), it just changes which one finishes first.
      --
      Athletic Scholarships to universities make as much sense as academic scholarships to sports teams.
    2. Re:Worst. Advice. Ever. by Black+Copter+Control · · Score: 2, Informative
      In short : nice doesn't change the total amount of time your processes take

      No. In the instant case, the problem was that the system was 'thrashing'. Useful data was being flushed, and it had to be reloaded from disk again and again. That causes the system to chew up extra resources and slows things down. In a case like that, increasing the priority of updatedb would have it get it's work done quickly during low priority times and then get out of the way. (of course, if you're on a server, you probably need to run updatedb weekly if at all.).

      The real answer to his problem is to add more memory. I can't believe the number of people who will get a hot CPU and not enough memory, then find out that they're bogged down because of paging. Disk I/O is orders of magnitude slower than memory. The only things you should be paging out is (almost) completely inactive tasks, or the inactive parts of running tasks. If working tasks regularly get paged out, it was time to add RAM a while ago.

      I'll almost always suggest to people to add memory before you jack up the CPU. It's usually way more efficient in terms of speeding the system up. 1Gz machine with 1GB of ram is often going to be way more usable than a 2Gz machine with 256MB, but the cost of upgrading your ram is way less than replacing the CPU (and probably the motherboard to boot). (YMMV).

      --
      OS Software is like love: The best way to make it grow is to give it away.
  3. Your shell may have its own version of nice by Anonymous Coward · · Score: 1, Informative

    Under FreeBSD default shell is csh and it has its own nice command version. So it is better to use full path if you wanna use /usr/bin/nice. Remember your shell deals with different commands and command line options to process your request:
    1. Internal commands aka shell builtin command (such as set or nice)
    2. External commands (such as clear, date)
    3. Aliases (such as alias rm='rm -i')
    4. Command substitutions ( such as echo "Today is $(date)")
    5. Functions
    6. Pipes ( such as cat /etc/passwd | wc -l)
    7. I/O redirection (such as cat /etc/passwd > /tmp/names)
    Src: http://www.cyberciti.biz/nixcraft/vivek/blogger/20 06/02/how-linux-or-unix-understand-which.php

  4. Re:what about killall by Stradenko · · Score: 4, Informative

    The above post refers to the killall from the psmisc package.

    The Sun Solaris "killall" command kills *all* processes.

    AIX "killall" kills all processes (except those in its family tree) owned by the calling user (maybe owned by the calling user *and* attached to the current terminal...).

  5. Re:Next up: "man nice" "man man" "man mount" ? by smoker2 · · Score: 2, Informative

    I renice 10 Folding@home so that the computer is actually useable when I need it. When I'm out, it can do what it wants !

  6. Re:Negative numbers for higher priority? by Hatta · · Score: 2, Informative

    Anyone know the historic reason why negative numbers are used for processes with HIGHER priority? It's counterintuitive and everything that's not *nix-like does it differently.

    Nice values measure how nice your programs are. Being nice means it gets out of the way for other programs. So a program with a nice value of 10 is nicer than that with a nice value of 0 and will get out of the way.

    We could do it the other way around and have a 'mean' program that assigns 'mean' values to programs which then hog the CPU. But only the super user would be able to assign positive values.

    --
    Give me Classic Slashdot or give me death!
  7. Re:Low numbers == High priority??? by NereusRen · · Score: 2, Informative

    It's because they changed the metaphor from "having priority" to "being nice." If a process is more nice, it lets other processes use CPU time first. If it is less nice, it hogs it all for itself.

    It's confusing if you are used to thinking in terms of priority, but it makes sense after the first few times you see it.

  8. nice for the Mac geeks by Been+on+TV · · Score: 3, Informative

    For Mac OS X users trying out the commands in the article, you need to type the following to get the list of processes as shown in the article:

    ps -ax -o pid,state,nice,command | less -5

    Also, on a standard Mac OS X system, the updatedb command to update the locate database is run by cron from the 500.weekly script located in /etc/periodic/weekly/.

    --
    The future is in beta
  9. Re:Have a DVD-ripping death match! by MoxFulder · · Score: 2, Informative

    Yes, that's a very good point. It would be nice if it was possible to throttle other resources in a uniform fashion.

    With network bandwidth it's quite application-specific. For example I can tell Azureus (uber-featureful bittorrent client) to only use a certain amount of upload bandwidth. But I can't do this with Gaim, and when I'm sending someone a big file too fast, my web browsing grinds to a halt. It'd be handy to have a uniform way to restrict the bandwidth of apps.

    Storage device accesses would be a LOT trickier IMHO. Without knowing the specifics of the device geometry and seek times etc., it's very hard to know how much of a drive's capacity is being used. As I suggested above, it's efficient to have one program read a DVD start-to-finish as fast as it can. It's *HORRIBLY* *AWFULLY* inneficient for TWO programs to do so at once (and from the sound of it, I worry that it will literally break my DVD drive :-)

  10. Re:Scheduling Priority is for sissys by cortana · · Score: 2, Informative

    For Linux news, LWN; for general tech/sci news, Technocrat.

    Slashdot has a *lot* more users than either though. Although some times it can seem otherwise, the good comments can show though... you just need to browse at +4 and ignore anything posted = 25 minutes after a story is posted. :)