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."

8 of 206 comments (clear)

  1. Re:Scheduling Priority is for sissys by Gothmolly · · Score: 2, Interesting

    If they're lucky, they'll get placed on the game grid, where they'll use futuristic "light cycles" and weird jai-lai pelotas to battle for supremacy.

    --
    I want to delete my account but Slashdot doesn't allow it.
  2. Repetitive tasks and tuning... by Dr.+Zowie · · Score: 5, Interesting

    I used to work at NASA/GSFC, and one of the workstations there sat all day running periodic housekeeping tasks from cron -- parsing telemetry, handling command load updates, etc. The problem was that every once in a while something would stall and the next batch of cron jobs would launch before the first ones completed. Instant snowballing death would ensue as nothing completed and the load average would soar into the hundreds as cron maniacally, stupidly spawned more and more processes into the poor overloaded workstation.

    There are several relevant tools available now but then I wrote my own - a perl script called "qproc" that would queue up jobs for execution, kill them if they hung too long, and refrain from launching multiple copies of the same job at the same time.

    Until I got hit by that, I never thought about the fact that cron is very dangerous to use on a production server. But it is -- if cron tasks use a non-infinitesimal part of the computer, you have to take steps to prevent the same marching-broomsticks failure mode.

  3. Off topic: Zombies by smcdow · · Score: 3, Interesting
    As someone who just had to deal with a machine becoming inoperable because the process table filled up with thousands of zombies because 3rd party software wasn't reaping its children.....

    Please, for the love of all that's holy and Unixy, teach yourselves what a SIGCHLD is and how to use wait(2).

    --
    In the course of every project, it will become necessary to shoot the scientists and begin production.
  4. Low numbers == High priority??? by AmbushBug · · Score: 2, Interesting

    Does anyone know why lower numbers give higher priority? Isn't it more intuitive to use higher numbers for higher priority? I'm curious as to why it was done this way...

  5. Re:Negative numbers for higher priority? by Adam+Heath · · Score: 2, Interesting

    This is really rather simple. Let's say you have a number, X. What comes before X? X-1. And what comes before that? X-2.

    So, now with that out of the way, let's say you want to iterate all numbers. Most sane people would start at either the beginning(low value) or the end(high value). And probably most would start at the beginning.

    When walking the list of things to run, a simple scheduler would act on the first thing it finds. This means that something that existed lower in this list would be run more often than something that existed later. So, that means that lower priority number actually means run more often.

  6. Nice is Nasty by redelm · · Score: 3, Interesting
    Seriously, nice is not a good performance tuning tool in most cases. All it does is shorten the timeslice, inducing more cache misses. The work remains the same or goes up due to cache reloads.

    A good [Linux] scheduler already does process restart immediately upon unblocking to reduce latency.

    But an overloaded box is still overloaded. The question is how you want it to fail. In what direction? A little cron job watching load with a shedding/restart list probably does better.

  7. Re:Have a DVD-ripping death match! by eyeball · · Score: 2, Interesting

    This brings up a good point. CPU isn't the only limited resource. I've often ran applications that saturate IO busses or network interfaces, or eat up a ton of memory, but only used a fraction of CPU time.

    In the first case, a large simple parsing app or file compression/decompression can saturate an IO bus. While performing such operations, other user-sensitive tasks like opening an application or checking mail. Granted most users don't do a lot of IO-flooding apps, but what's more prevalent are network-flooding operations. Just recently, while I was downloading some linux ISOs via HTTP, my web browsing was slow the whole time. Sure QoS can help some of these issues, like putting a higher priority on Game network traffic, but probably wouldn't help web browsing while downloading large files.

    It would be nice (no pun intended) to be able to restrict or throttle other resources besides CPU. i.e.:

    nice -n-19 wget http://example.com/linux.iso
    nice -i-19 gzip bighugefile.csv

    This probably exists in Linux already.

    --

    _______
    2B1ASK1
  8. nice -5 apachectl start by Spazmania · · Score: 2, Interesting

    Its also very helpful to run Apache at nice level 5. That way when the CGI programs go nuts and the load shoots up to 200 the sshd process won't get starved for CPU time and you can still log in to fix the server.

    --
    Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.