Statistics
| Branch: | Revision:

root / drivers / td-rated.1.txt @ abdb293f

History | View | Annotate | Download (6.2 kB)

1

    
2
SYNOPSIS
3

    
4
    td-rated <name> -type {token|leaky|meminfo} -- [options]
5

    
6
DESCRIPTION
7

    
8
    The td-rated 'bridge' is a daemon program to which one or a number
9
    of tapdisk processes connect, in order to cooperatively limit the
10
    data rate at which they will issue I/O requests to physical
11
    storage.
12

    
13
    A data rate denotes I/O bandwidth, i.e. an (average) amount of
14
    data over time. A rate limiter is a state machine dispatching an
15
    overall queue of incoming I/O requests, at a desired data rate.
16

    
17
    The td-rated program included a number of alternative rate
18
    limiting algorithms for various purposes. Rate limiters are
19
    discussed below.
20

    
21
    The standard client implementation in tapdisk is a transparent
22
    filter driver, of type name 'valve'. Valves are typically inserted
23
    at either the top of certain level of the disk image stack
24
    constituting a VDI, thereby uniformly limiting any I/O issued.
25

    
26
    Every bridge process constitutes a single rate limiter. Arbitrary
27
    numbers of client valves can connect to each bridge. I/O requests
28
    issued by clients are normally aggregated, dividing the available
29
    bandwidth among all active clients.
30

    
31
OPTIONS
32

    
33
    Token Bucket
34

    
35
	Token bucket is a rate limiter which drains a request queue of
36
	pending I/O requests at a given overall data rate. It is
37
	invoked as follows:
38

    
39
	td-rated -t token -- ..
40

    
41
	--rate <limit>
42
		Bandwidth limit [B/s].
43

    
44
	--cap <limit>
45
		Burst (aggregated credit) limit [B].
46

    
47
	Token bucket's main feature over basic constant-rate
48
	algorithms (leaky buckets) is that it allows for I/O
49
	bursts. Bursts are batches of data request, which are
50
	preferably issued simultaneously to reduce the overall number
51
	of seeks involved on shared rotational media. 
52

    
53
	With bursty I/O transfers, bandwidth may transiently exceed
54
	the nominal data rate, but in a controlled fashion. Different
55
	from a constant rate output, the I/O output rate is maintained
56
	as an average over periods of time.
57

    
58
	Internally, bursts issued at any time instant consume
59
	bandwidth credit ('tokens'). Credit gets accumulated, at the
60
	given rate, over time. Once exhausted, credit taken must be
61
	amortized before additional I/O can pass. That is, while the
62
	rate set will limit an output data rate, it does so only
63
	indirectly, by limiting the rate at which new credit is
64
	assigned.
65

    
66
	The cap argument is a limit to accumulated credit. Excess
67
	credit above the given capacity will be discarded. Caps limit
68
	the maximum burst size observable. The maximum only becomes
69
	available whenever all clients remained idle for for a time
70
	perid of cap/rate.
71

    
72
	A token bucket allows for bursts, it does not promote or
73
	enforce them at. Once configured bandwidth credit is exeeded,
74
	amortization time is applied to client request batches
75
	individually, in the order in which they were issued, and
76
	output will effectively degrade to a constant data rate.
77
 
78
    Leaky Bucket
79

    
80
	Leaky bucket is a simpler constant rate algorithm. Requests
81
	are issued in a round-robin fashion. The given rate is never
82
	exceeded, so requests.
83

    
84
	This is presently equivalent to a token bucket with a cap
85
	value of zero, and therefore implemented accordingly.
86

    
87
	td-rated -t leaky -- ..
88

    
89
        --rate <limit>
90
		Bandwidth limit [B/s].
91

    
92
    Meminfo Driver
93

    
94
	Meminfo is an experimental rate limiting driver aiming
95
	specifically at write bandwidth reduction for tapdisk I/O
96
	modes targeting the host OS buffer cache. It is invoked as
97
	follows
98

    
99
	td-rated -t meminfo -- ..
100
	
101
	--high <limit>
102
	        [% of total memory]
103

    
104
	--low <limit>
105
	        [% of total memory]
106

    
107
	[--period <time>]
108
		Memory stats update period [ms]
109
		Default: 100
110

    
111
	-t <type> ...
112
		Subordinate rate limiter type.
113

    
114
	-- [ subordinate options .. ]
115

    
116
	Where the subordinate type and options typically invokes one
117
	of the basic rate-oriented algorithms described above.
118

    
119
	Memory limits are not bandwidth limits, but cache utilization
120
	bounds aimed to be met. The arguments to --high and --low
121
	options are watermarks setting hysteresis limits on domain OS
122
	cache utilization detected. They are defined in percent of
123
	total memory available to the domain OS.
124
	
125
	The driver periodically scans OS memory statistics to estimate
126
	present host buffer I/O loads. By default a state update is
127
	performed every 100ms.
128

    
129
	The cache is considered underutilized while the amount of
130
	memory either modified, or under writeback, does not exceed
131
	the percentage indicated by --high. In that state, I/O will
132
	pass unrestricted.
133

    
134
	Once the --high limit is exceeded, a congestion mode of
135
	operation is entered, where the output data rate is
136
	reduced. That state prevails until the cache is detected
137
	underutilized again, at a value below or equal the --low
138
	watermark.
139

    
140
	Meminfo rate limiting is driven by overall domain state,
141
	commonly involving applications not sharing the same domain of
142
	bandwidth arbitration. I/O can therefore only be throttled,
143
	not blocked, or would risk starvation. For that purpose, the
144
	meminfo driver requires a (configurable) subordinate rate
145
	limiter. This may be any of the raw bandwidth-oriented
146
	implementations available.
147

    
148
    Limit Formats
149

    
150
        I/O size and limit values specified at td-rated invocation
151
        time are integers in units of bytes, or integers as multiples
152
        of units given in either SI decimal (K,M,G) or IEC binary
153
        (Ki,Mi,Gi) suffix notation, e.g. 10k (10 * 2^10 B), 128Mi (128
154
        * 10^6 B), 1Gi (1 * 10^9 B).
155

    
156
EXAMPLES
157

    
158
    Invocations
159
 
160
	td-rated /var/run/blktap/x.sk -t leaky -- \
161
		--rate=60M
162

    
163
	  Constant-rate output rate limit at 60M/s. Listening for
164
	  client connections at /var/run/blktap/x.sk.
165

    
166
	td-rated /var/run/blktap/y.sk -t token -- \
167
		--rate=80M --cap 10M
168

    
169
	  Token bucket rate limiting at 80M/s with a burst limit of 10M.
170
	
171
	td-rated /var/run/blktap/y.sk -t meminfo -- \
172
		--low=40 --high=60 -t leaky -- --rate=15M
173

    
174
	  Buffer I/O rate limiting with a high/low cache utilization
175
	  watermark of 60%/40% of host memory. Once the upper limit is
176
	  met, constant rate output targeting a limit of 10M/s is
177
	  applied.
178

    
179
    Image Chain
180

    
181
	tap-ctl create x-chain:/var/tmp/limit.chain
182

    
183
	/var/tmp/limit.chain:
184
		valve:/var/run/blktap/x.sk
185
		vhd:/dev/vg/image.vhd
186

    
187
BUGS
188

    
189
    The -t leaky type isn't really aliased yet properly.
190
    Use the form -t token -- --cap=0 instead.