1NICELOAD(1)                        parallel                        NICELOAD(1)
2
3
4

NAME

6       niceload - slow down a program when the load average is above a certain
7       limit
8

SYNOPSIS

10       niceload [-v] [-h] [-n nice] [-I io] [-L load] [-M mem] [-N] [--sensor
11       program] [-t time] [-s time|-f factor] ( command | -p PID [-p PID ...]
12       | --prg program )
13

DESCRIPTION

15       GNU niceload will slow down a program when the load average (or other
16       system activity) is above a certain limit. When the limit is reached
17       the program will be suspended for some time. Then resumed again for
18       some time.  Then the load average is checked again and we start over.
19
20       Instead of load average niceload can also look at disk I/O, amount of
21       free memory, or swapping activity.
22
23       If the load is 3.00 then the default settings will run a program like
24       this:
25
26       run 1 second, suspend (3.00-1.00) seconds, run 1 second, suspend
27       (3.00-1.00) seconds, run 1 second, ...
28

OPTIONS

30       -B
31       --battery
32                Suspend if the system is running on battery. Shorthand for: -l
33                -1 --sensor 'cat /sys/class/power_supply/BAT0/status
34                /proc/acpi/battery/BAT0/state 2>/dev/null |grep -i -q
35                discharging; echo $?'
36
37       -f FACTOR
38       --factor FACTOR
39                Suspend time factor. Dynamically set -s as amount over limit *
40                factor. Default is 1.
41
42       -H
43       --hard   Hard limit. --hard will suspend the process until the system
44                is under the limits. The default is --soft.
45
46       --io iolimit
47       -I iolimit
48                Limit for I/O. The amount of disk I/O will be computed as a
49                value 0 - 10, where 0 is no I/O and 10 is at least one disk is
50                100% saturated.
51
52                --io will set both --start-io and run-io.
53
54       --load loadlimit
55       -L loadlimit
56                Limit for load average.
57
58                --load will set both --start-load and run-load.
59
60       --mem memlimit
61       -M memlimit
62                Limit for free memory. This is the amount of bytes available
63                as free + cache. This limit is treated opposite other limits:
64                If the system is above the limit the program will run, if it
65                is below the limit the program will stop
66
67                memlimit can be postfixed with K, M, G, T, or P which would
68                multiply the size with 1024, 1048576, 1073741824, or
69                1099511627776 respectively.
70
71                --mem will set both --start-mem and run-mem.
72
73       --noswap
74       -N       No swapping. If the system is swapping both in and out it is a
75                good indication that the system is memory stressed.
76
77                --noswap is over limit if the system is swapping both in and
78                out.
79
80                --noswap will set both --start-noswap and run-noswap.
81
82       --net    Shorthand for --nethops 3.
83
84       --nethops h
85                Network nice. Pause if the internet connection is overloaded.
86
87                niceload finds a router h hops closer to the internet. It
88                pings this every second. If the latency is more than 50%
89                bigger than the median, it is regarded as being over the
90                limit.
91
92                --nethops can be combined with --hard. Without --hard the
93                program may be able to queue up so much traffic that it will
94                take longer than the --suspend time to clear it. --hard is
95                useful for traffic that does not break by being suspended for
96                a longer time.
97
98                --nethops can be combined with a high --suspend. This way a
99                program can be allowed to do a bit of traffic now and then.
100                This is useful to keep the connection alive.
101
102       -n niceness
103       --nice niceness
104                Sets niceness. See nice(1).
105
106       -p PID[,PID] (alpha testing)
107       --pid PID[,PID] (alpha testing)
108                Process IDs of processes to suspend. You can specify multiple
109                process IDs with multiple -p PID or by separating the PIDs
110                with comma.
111
112       --prg program
113       --program program
114                Name of running program to suspend. You can specify multiple
115                programs with multiple --prg program. If no processes with the
116                name program is found, niceload with search for substrings
117                containing program.
118
119       --quote
120       -q       Quote the command line. Useful if the command contains chars
121                like *, $, >, and " that should not be interpreted by the
122                shell.
123
124       --run-io iolimit
125       --ri iolimit
126       --run-load loadlimit
127       --rl loadlimit
128       --run-mem memlimit
129       --rm memlimit
130                Run limit. The running program will be slowed down if the
131                system is above the limit. See: --io, --load, --mem, --noswap.
132
133       --sensor sensor program
134                Read sensor. Use sensor program to read a sensor.
135
136                This will keep the CPU temperature below 80 deg C on
137                GNU/Linux:
138
139                  niceload -l 80000 -f 0.001 --sensor 'sort -n /sys/devices/platform/coretemp*/temp*_input' gzip *
140
141                This will stop if the disk space < 100000.
142
143                  niceload -H -l -100000 --sensor "df . | awk '{ print \$4 }'" echo
144
145       --start-io iolimit
146       --si iolimit
147       --start-load loadlimit
148       --sl loadlimit
149       --start-mem memlimit
150       --sm memlimit
151                Start limit. The program will not start until the system is
152                below the limit. See: --io, --load, --mem, --noswap.
153
154       --soft
155       -S       Soft limit. niceload will suspend a process for a while and
156                then let it run for a second thus only slowing down a process
157                while the system is over one of the given limits. This is the
158                default.
159
160       --suspend SEC
161       -s SEC   Suspend time. Suspend the command this many seconds when the
162                max load average is reached.
163
164       --recheck SEC
165       -t SEC   Recheck load time. Sleep SEC seconds before checking load
166                again. Default is 1 second.
167
168       --verbose
169       -v       Verbose. Print some extra output on what is happening. Use -v
170                until you know what your are doing.
171

EXAMPLE: See niceload in action

173       In terminal 1 run: top
174
175       In terminal 2 run:
176
177       niceload -q perl -e '$|=1;do{$l==$r or print ".";
178       $l=$r}until(($r=time-$^T)>50)'
179
180       This will print a '.' every second for 50 seconds and eat a lot of CPU.
181       When the load rises to 1.0 the process is suspended.
182

EXAMPLE: Run updatedb

184       Running updatedb can often starve the system for disk I/O and thus
185       result in a high load.
186
187       Run updatedb but suspend updatedb if the load is above 2.00:
188
189       niceload -L 2 updatedb
190

EXAMPLE: Run rsync

192       rsync can just like updatedb starve the system for disk I/O and thus
193       result in a high load.
194
195       Run rsync but keep load below 3.4. If load reaches 7 sleep for
196       (7-3.4)*12 seconds:
197
198       niceload -L 3.4 -f 12 rsync -Ha /home/ /backup/home/
199

EXAMPLE: Ensure enough disk cache

201       Assume the program foo uses 2 GB files intensively. foo will run fast
202       if the files are in disk cache and be slow as a crawl if they are not
203       in the cache.
204
205       To ensure 2 GB are reserved for disk cache run:
206
207       niceload --hard --run-mem 2g foo
208
209       This will not guarantee that the 2 GB memory will be used for the files
210       for foo, but it will stop foo if the memory for disk cache is too low.
211

ENVIRONMENT VARIABLES

213       None. In future versions $NICELOAD will be able to contain default
214       settings.
215

EXIT STATUS

217       Exit status should be the same as the command being run (untested).
218

REPORTING BUGS

220       Report bugs to <bug-parallel@gnu.org>.
221

AUTHOR

223       Copyright (C) 2004-11-19 Ole Tange, http://ole.tange.dk
224
225       Copyright (C) 2005,2006,2006,2008,2009,2010 Ole Tange,
226       http://ole.tange.dk
227
228       Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017,2018 Ole Tange,
229       http://ole.tange.dk and Free Software Foundation, Inc.
230

LICENSE

232       Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017,2018 Free
233       Software Foundation, Inc.
234
235       This program is free software; you can redistribute it and/or modify it
236       under the terms of the GNU General Public License as published by the
237       Free Software Foundation; either version 3 of the License, or at your
238       option any later version.
239
240       This program is distributed in the hope that it will be useful, but
241       WITHOUT ANY WARRANTY; without even the implied warranty of
242       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
243       General Public License for more details.
244
245       You should have received a copy of the GNU General Public License along
246       with this program.  If not, see <http://www.gnu.org/licenses/>.
247
248   Documentation license I
249       Permission is granted to copy, distribute and/or modify this
250       documentation under the terms of the GNU Free Documentation License,
251       Version 1.3 or any later version published by the Free Software
252       Foundation; with no Invariant Sections, with no Front-Cover Texts, and
253       with no Back-Cover Texts.  A copy of the license is included in the
254       file fdl.txt.
255
256   Documentation license II
257       You are free:
258
259       to Share to copy, distribute and transmit the work
260
261       to Remix to adapt the work
262
263       Under the following conditions:
264
265       Attribution
266                You must attribute the work in the manner specified by the
267                author or licensor (but not in any way that suggests that they
268                endorse you or your use of the work).
269
270       Share Alike
271                If you alter, transform, or build upon this work, you may
272                distribute the resulting work only under the same, similar or
273                a compatible license.
274
275       With the understanding that:
276
277       Waiver   Any of the above conditions can be waived if you get
278                permission from the copyright holder.
279
280       Public Domain
281                Where the work or any of its elements is in the public domain
282                under applicable law, that status is in no way affected by the
283                license.
284
285       Other Rights
286                In no way are any of the following rights affected by the
287                license:
288
289                · Your fair dealing or fair use rights, or other applicable
290                  copyright exceptions and limitations;
291
292                · The author's moral rights;
293
294                · Rights other persons may have either in the work itself or
295                  in how the work is used, such as publicity or privacy
296                  rights.
297
298       Notice   For any reuse or distribution, you must make clear to others
299                the license terms of this work.
300
301       A copy of the full license is included in the file as cc-by-sa.txt.
302

DEPENDENCIES

304       GNU niceload uses Perl, and the Perl modules POSIX, and Getopt::Long.
305

SEE ALSO

307       parallel(1), nice(1), uptime(1)
308
309
310
31120180222                          2018-03-21                       NICELOAD(1)
Impressum