Blob


1 .TH VENTI 8
2 .SH NAME
3 venti \- archival storage server
4 .SH SYNOPSIS
5 .in +0.25i
6 .ti -0.25i
7 .B venti/venti
8 [
9 .B -Ldrs
10 ]
11 [
12 .B -a
13 .I address
14 ]
15 [
16 .B -B
17 .I blockcachesize
18 ]
19 [
20 .B -c
21 .I config
22 ]
23 [
24 .B -C
25 .I lumpcachesize
26 ]
27 [
28 .B -h
29 .I httpaddress
30 ]
31 [
32 .B -I
33 .I indexcachesize
34 ]
35 [
36 .B -W
37 .I webroot
38 ]
39 .SH DESCRIPTION
40 .I Venti
41 is a SHA1-addressed archival storage server.
42 See
43 .IR venti (7)
44 for a full introduction to the system.
45 This page documents the structure and operation of the server.
46 .PP
47 A venti server requires multiple disks or disk partitions,
48 each of which must be properly formatted before the server
49 can be run.
50 .SS Disk
51 The venti server maintains three disk structures, typically
52 stored on raw disk partitions:
53 the append-only
54 .IR "data log" ,
55 which holds, in sequential order,
56 the contents of every block written to the server;
57 the
58 .IR index ,
59 which helps locate a block in the data log given its score;
60 and optionally the
61 .IR "bloom filter" ,
62 a concise summary of which scores are present in the index.
63 The data log is the primary storage.
64 To improve the robustness, it should be stored on
65 a device that provides RAID functionality.
66 The index and the bloom filter are optimizations
67 employed to access the data log efficiently and can be rebuilt
68 if lost or damaged.
69 .PP
70 The data log is logically split into sections called
71 .IR arenas ,
72 typically sized for easy offline backup
73 (e.g., 500MB).
74 A data log may comprise many disks, each storing
75 one or more arenas.
76 Such disks are called
77 .IR "arena partitions" .
78 Arena partitions are filled in the order given in the configuration.
79 .PP
80 The index is logically split into block-sized pieces called
81 .IR buckets ,
82 each of which is responsible for a particular range of scores.
83 An index may be split across many disks, each storing many buckets.
84 Such disks are called
85 .IR "index sections" .
86 .PP
87 The index must be sized so that no bucket is full.
88 When a bucket fills, the server must be shut down and
89 the index made larger.
90 Since scores appear random, each bucket will contain
91 approximately the same number of entries.
92 Index entries are 40 bytes long. Assuming that a typical block
93 being written to the server is 8192 bytes and compresses to 4096
94 bytes, the active index is expected to be about 1% of
95 the active data log.
96 Storing smaller blocks increases the relative index footprint;
97 storing larger blocks decreases it.
98 To allow variation in both block size and the random distribution
99 of scores to buckets, the suggested index size is 5% of
100 the active data log.
101 .PP
102 The (optional) bloom filter is a large bitmap that is stored on disk but
103 also kept completely in memory while the venti server runs.
104 It helps the venti server efficiently detect scores that are
105 .I not
106 already stored in the index.
107 The bloom filter starts out zeroed.
108 Each score recorded in the bloom filter is hashed to choose
109 .I nhash
110 bits to set in the bloom filter.
111 A score is definitely not stored in the index of any of its
112 .I nhash
113 bits are not set.
114 The bloom filter thus has two parameters:
115 .I nhash
116 (maximum 32)
117 and the total bitmap size
118 (maximum 512MB, 2\s-2\u32\d\s+2 bits).
119 .PP
120 The bloom filter should be sized so that
121 .I nhash
122 \(mu
123 .I nblock
124 \(<=
125 0.7 \(mu
126 .IR b ,
127 where
128 .I nblock
129 is the expected number of blocks stored on the server
130 and
131 .I b
132 is the bitmap size in bits.
133 The false positive rate of the bloom filter when sized
134 this way is approximately 2\s-2\u\-\fInblock\fR\d\s+2.
135 .I Nhash
136 less than 10 are not very useful;
137 .I nhash
138 greater than 24 are probably a waste of memory.
139 .I Fmtbloom
140 (see
141 .IR venti-fmt (8))
142 can be given either
143 .I nhash
144 or
145 .IR nblock ;
146 if given
147 .IR nblock ,
148 it will derive an appropriate
149 .IR nhash .
150 .SS Memory
151 Venti can make effective use of large amounts of memory
152 for various caches.
153 .PP
154 The
155 .I "lump cache
156 holds recently-accessed venti data blocks, which the server refers to as
157 .IR lumps .
158 The lump cache should be at least 1MB but can profitably be much larger.
159 The lump cache can be thought of as the level-1 cache:
160 read requests handled by the lump cache can
161 be served instantly.
162 .PP
163 The
164 .I "block cache
165 holds recently-accessed
166 .I disk
167 blocks from the arena partitions.
168 The block cache needs to be able to simultaneously hold two blocks
169 from each arena plus four blocks for the currently-filling arena.
170 The block cache can be thought of as the level-2 cache:
171 read requests handled by the block cache are slower than those
172 handled by the lump cache, since the lump data must be extracted
173 from the raw disk blocks and possibly decompressed, but no
174 disk accesses are necessary.
175 .PP
176 The
177 .I "index cache
178 holds recently-accessed or prefetched
179 index entries.
180 The index cache needs to be able to hold index entries
181 for three or four arenas, at least, in order for prefetching
182 to work properly. Each index entry is 50 bytes.
183 Assuming 500MB arenas of
184 128,000 blocks that are 4096 bytes each after compression,
185 the minimum index cache size is about 6MB.
186 The index cache can be thought of as the level-3 cache:
187 read requests handled by the index cache must still go
188 to disk to fetch the arena blocks, but the costly random
189 access to the index is avoided.
190 .PP
191 The size of the index cache determines how long venti
192 can sustain its `burst' write throughput, during which time
193 the only disk accesses on the critical path
194 are sequential writes to the arena partitions.
195 For example, if you want to be able to sustain 10MB/s
196 for an hour, you need enough index cache to hold entries
197 for 36GB of blocks. Assuming 8192-byte blocks,
198 you need room for almost five million index entries.
199 Since index entries are 50 bytes each, you need 250MB
200 of index cache.
201 If the background index update process can make a single
202 pass through the index in an hour, which is possible,
203 then you can sustain the 10MB/s indefinitely (at least until
204 the arenas are all filled).
205 .PP
206 The
207 .I "bloom filter
208 requires memory equal to its size on disk,
209 as discussed above.
210 .PP
211 A reasonable starting allocation is to
212 divide memory equally (in thirds) between
213 the bloom filter, the index cache, and the lump and block caches;
214 the third of memory allocated to the lump and block caches
215 should be split unevenly, with more (say, two thirds)
216 going to the block cache.
217 .SS Network
218 The venti server announces two network services, one
219 (conventionally TCP port
220 .BR venti ,
221 17034) serving
222 the venti protocol as described in
223 .IR venti (7),
224 and one serving HTTP
225 (conventionally TCP port
226 .BR http ,
227 80).
228 .PP
229 The venti web server provides the following
230 URLs for accessing status information:
231 .TF "\fL/storage"
232 .PD
233 .TP
234 .B /index
235 A summary of the usage of the arenas and index sections.
236 .TP
237 .B /xindex
238 An XML version of
239 .BR /index .
240 .TP
241 .B /storage
242 Brief storage totals.
243 .TP
244 .BI /set/ variable
245 The current integer value of
246 .IR variable .
247 Variables are:
248 .BR compress ,
249 whether or not to compress blocks
250 (for debugging);
251 .BR logging ,
252 whether to write entries to the debugging logs;
253 .BR stats ,
254 whether to collect run-time statistics;
255 .BR icachesleeptime ,
256 the time in milliseconds between successive updates
257 of megabytes of the index cache;
258 .BR arenasumsleeptime ,
259 the time in milliseconds between reads while
260 checksumming an arena in the background.
261 The two sleep times should be (but are not) managed by venti;
262 they exist to provide more experience with their effects.
263 The other variables exist only for debugging and
264 performance measurement.
265 .TP
266 .BI /set/ variable / value
267 Set
268 .I variable
269 to
270 .IR value .
271 .TP
272 .BI /graph/ name / param / param / \fR...
273 A PNG image graphing the named run-time statistic over time.
274 The details of names and parameters are undocumented;
275 see
276 .B httpd.c
277 in the venti sources.
278 .TP
279 .B /log
280 A list of all debugging logs present in the server's memory.
281 .TP
282 .BI /log/ name
283 The contents of the debugging log with the given
284 .IR name .
285 .TP
286 .B /flushicache
287 Force venti to begin flushing the index cache to disk.
288 The request response will not be sent until the flush
289 has completed.
290 .TP
291 .B /flushdcache
292 Force venti to begin flushing the arena block cache to disk.
293 The request response will not be sent until the flush
294 has completed.
295 .PD
296 .PP
297 Requests for other files are served by consulting a
298 directory named in the configuration file
299 (see
300 .B webroot
301 below).
302 .SS Configuration File
303 A venti configuration file
304 enumerates the various index sections and
305 arenas that constitute a venti system.
306 The components are indicated by the name of the file, typically
307 a disk partition, in which they reside. The configuration
308 file is the only location that file names are used. Internally,
309 venti uses the names assigned when the components were formatted
310 with
311 .I fmtarenas
312 or
313 .I fmtisect
314 (see
315 .IR venti-fmt (8)).
316 In particular, only the configuration needs to be
317 changed if a component is moved to a different file.
318 .PP
319 The configuration file consists of lines in the form described below.
320 Lines starting with
321 .B #
322 are comments.
323 .TF "\fLindex\fI name "
324 .PD
325 .TP
326 .BI index " name
327 Names the index for the system.
328 .TP
329 .BI arenas " file
330 .I File
331 is an arena partition, formatted using
332 .IR fmtarenas .
333 .TP
334 .BI isect " file
335 .I File
336 is an index section, formatted using
337 .IR fmtisect .
338 .TP
339 .BI bloom " file
340 .I File
341 is a bloom filter, formatted using
342 .IR fmtbloom .
343 .PD
344 .PP
345 After formatting a venti system using
346 .IR fmtindex ,
347 the order of arenas and index sections should not be changed.
348 Additional arenas can be appended to the configuration;
349 run
350 .I fmtindex
351 with the
352 .B -a
353 flag to update the index.
354 .PP
355 The configuration file also holds configuration parameters
356 for the venti server itself.
357 These are:
358 .TF "\fLhttpaddr\fI netaddr "
359 .TP
360 .BI mem " size
361 lump cache size
362 .TP
363 .BI bcmem " size
364 block cache size
365 .TP
366 .BI icmem " size
367 index cache size
368 .TP
369 .BI addr " netaddr
370 network address to announce venti service
371 (default
372 .BR tcp!*!venti )
373 .TP
374 .BI httpaddr " netaddr
375 network address to announce HTTP service
376 (default
377 .BR tcp!*!http )
378 .TP
379 .B queuewrites
380 queue writes in memory
381 (default is not to queue)
382 .TP
383 .BI webroot " dir
384 directory tree containing files for
385 .IR venti 's
386 internal HTTP server to consult for unrecognized URLs
387 .PD
388 .PP
389 The units for the various cache sizes above can be specified by appending a
390 .LR k ,
391 .LR m ,
392 or
393 .LR g
394 (case-insensitive)
395 to indicate kilobytes, megabytes, or gigabytes respectively.
396 .PP
397 The
398 .I file
399 name in the configuration lines above can be of the form
400 .IB file : lo - hi
401 to specify a range of the file.
402 .I Lo
403 and
404 .I hi
405 are specified in bytes but can have the usual
406 .BI k ,
407 .BI m ,
408 or
409 .B g
410 suffixes.
411 Either
412 .I lo
413 or
414 .I hi
415 may be omitted.
416 This notation eliminates the need to
417 partition raw disks on non-Plan 9 systems.
418 .SS Command Line
419 Many of the options to Venti duplicate parameters that
420 can be specified in the configuration file.
421 The command line options override those found in a
422 configuration file.
423 Additional options are:
424 .TF "\fL-c\fI config"
425 .PD
426 .TP
427 .BI -c " config
428 The server configuration file
429 (default
430 .BR venti.conf )
431 .TP
432 .B -d
433 Produce various debugging information on standard error.
434 Implies
435 .BR -s .
436 .TP
437 .B -L
438 Enable logging. By default all logging is disabled.
439 Logging slows server operation considerably.
440 .TP
441 .B -r
442 Allow only read access to the venti data.
443 .TP
444 .B -s
445 Do not run in the background.
446 Normally,
447 the foreground process will exit once the Venti server
448 is initialized and ready for connections.
449 .PD
450 .SH EXAMPLE
451 A simple configuration:
452 .IP
453 .EX
454 % cat venti.conf
455 index main
456 isect /tmp/disks/isect0
457 isect /tmp/disks/isect1
458 arenas /tmp/disks/arenas
459 bloom /tmp/disks/bloom
460 mem 10M
461 bcmem 20M
462 icmem 30M
464 .EE
465 .PP
466 Format the index sections, the arena partition,
467 the bloom filter, and
468 finally the main index:
469 .IP
470 .EX
471 % venti/fmtisect isect0. /tmp/disks/isect0
472 % venti/fmtisect isect1. /tmp/disks/isect1
473 % venti/fmtarenas arenas0. /tmp/disks/arenas &
474 % venti/fmtbloom /tmp/disks/bloom &
475 % wait
476 % venti/fmtindex venti.conf
478 .EE
479 .PP
480 Start the server and check the storage statistics:
481 .IP
482 .EX
483 % venti/venti
484 % hget http://$sysname/storage
485 .EE
486 .SH SOURCE
487 .B \*9/src/cmd/venti/srv
488 .SH "SEE ALSO"
489 .IR venti (1),
490 .IR venti (3),
491 .IR venti (7),
492 .IR venti-backup (8)
493 .IR venti-fmt (8)
494 .br
495 Sean Quinlan and Sean Dorward,
496 ``Venti: a new approach to archival storage'',
497 .I "Usenix Conference on File and Storage Technologies" ,
498 2002.
499 .SH BUGS
500 Setting up a venti server is too complicated.
501 .PP
502 Venti should not require the user to decide how to
503 partition its memory usage.
504 .PP
505 Users of shells other than
506 .IR rc (1)
507 will not be able to use the program names shown.
508 One solution is to define
509 .B "V=$PLAN9/bin/venti"
510 and then substitute
511 .B $V/
512 for
513 .B venti/
514 in the paths above.