1nbdkit-rate-filter(1)               NBDKIT               nbdkit-rate-filter(1)
2
3
4

NAME

6       nbdkit-rate-filter - limit bandwidth by connection or server
7

SYNOPSIS

9        nbdkit --filter=rate PLUGIN [PLUGIN-ARGS...]
10                             [rate=BITSPERSEC]
11                             [connection-rate=BITSPERSEC]
12                             [rate-file=FILENAME] [connection-rate-file=FILENAME]
13

DESCRIPTION

15       "nbdkit-rate-filter" is a filter that limits the bandwidth that can be
16       used by the server.  Limits can be applied per connection and/or for
17       the server as a whole.
18

EXAMPLES

20       nbdkit --filter=rate memory size=64M rate=1M
21           Create a 64M RAM disk and limit server bandwidth as a whole to a
22           maximum of 1 Mbps (megabit per second).
23
24       nbdkit --filter=rate memory size=64M connection-rate=50K
25           Limit each connection to 50 Kbps (kilobits per second).  However as
26           there is no limit to the number of simultaneous connections this
27           does not limit overall server bandwidth.
28
29       nbdkit --filter=rate memory size=64M connection-rate=50K rate=1M
30           Limit each connection to 50 Kbps.  Additionally the total bandwidth
31           across all connections to the server is limited to 1 Mbps.
32
33       nbdkit --filter=rate memory size=64M rate=1M rate-file=/tmp/rate
34           Initially limit bandwidth to 1 Mbps.  While the server is running
35           the rate can be adjusted dynamically by writing a different rate
36           into /tmp/rate.
37

PARAMETERS

39       connection-rate=BITSPERSEC
40           Limit each connection to "BITSPERSEC".
41
42       rate=BITSPERSEC
43           Limit total bandwidth across all connections to "BITSPERSEC".
44
45       connection-rate-file=FILENAME
46       rate-file=FILENAME
47           Adjust the per-connection or total bandwidth dynamically by writing
48           "BITSPERSEC" into "FILENAME".  See "DYNAMIC ADJUSTMENT" below.
49
50       "BITSPERSEC" can be specified as a simple number, or you can use a
51       number followed by "K", "M" etc to mean kilobits, megabits and so on.
52

DYNAMIC ADJUSTMENT

54       Using the "connection-rate-file" or "rate-file" parameters you can
55       dynamically adjust the bandwidth while the server is running.
56
57       If the file is not present when the server starts up then the initial
58       rate is taken from the associated "connection-rate" or "rate" parameter
59       (or if that is not present, then it is unlimited).  If the file is
60       deleted while the server is running then the last rate read from the
61       file continues to be used.
62
63       The file should be updated atomically (eg. create a new file, then
64       rename or mv(1) the new file over the old file).
65
66       There will be a short delay between the file being updated and the new
67       rate coming into effect.
68

NOTES

70       You can specify "rate" and "connection-rate" on their own or together.
71       If you specify neither, the filter is turned off.
72
73       The rate filter approximates the bandwidth used by the NBD protocol on
74       the wire.  Some operations such as zeroing and trimming are effectively
75       free (because only a tiny NBD message is sent over the network) and so
76       do not count against the bandwidth limit.  NBD and TCP protocol
77       overhead is not included, so you may find that other tools such as
78       tc(8) and iptables(8) give more accurate results.
79
80       There are separate bandwidth limits for read and write (ie. download
81       and upload to the server).
82
83       If the size of requests made by your client is much larger than the
84       rate limit then you can see long, lumpy sleeps in this filter.  In the
85       future we may modify the filter to break up large requests
86       automatically in order to limit the length of sleeps.  Placing the
87       nbdkit-blocksize-filter(1) in front of this filter may help in the
88       meantime.
89

SEE ALSO

91       nbdkit(1), nbdkit-blocksize-filter(1), nbdkit-delay-filter(1),
92       nbdkit-filter(3), iptables(8), tc(8).
93

AUTHORS

95       Richard W.M. Jones
96
98       Copyright (C) 2019 Red Hat Inc.
99

LICENSE

101       Redistribution and use in source and binary forms, with or without
102       modification, are permitted provided that the following conditions are
103       met:
104
105       ·   Redistributions of source code must retain the above copyright
106           notice, this list of conditions and the following disclaimer.
107
108       ·   Redistributions in binary form must reproduce the above copyright
109           notice, this list of conditions and the following disclaimer in the
110           documentation and/or other materials provided with the
111           distribution.
112
113       ·   Neither the name of Red Hat nor the names of its contributors may
114           be used to endorse or promote products derived from this software
115           without specific prior written permission.
116
117       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
118       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
119       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
120       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
121       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
122       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
123       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
124       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
125       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
126       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
127       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
128
129
130
131nbdkit-1.12.3                     2019-05-21             nbdkit-rate-filter(1)
Impressum