hank / life

Good code.

This URL has Read+Write access

life / oscon / 2008 / sessions / Hypertable.html
100644 415 lines (307 sloc) 6.127 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>RDoc Documentation</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h2>File: Hypertable.rdoc</h2>
<table>
  <tr><td>Path:</td><td>Hypertable.rdoc</td></tr>
  <tr><td>Modified:</td><td>Wed Jul 23 16:33:58 -0700 2008</td></tr>
</table>
 
<h1>OSCON 2008, Session 3: Hypertable</h1>
<h2>GFS</h2>
<ul>
<li>Run on 1000 machines, not 1
 
</li>
</ul>
<h3>Filesystem</h3>
<ul>
<li>64MB chunk
 
</li>
<li>Replicates each chunk across machines
 
</li>
<li>By doing so, system is impervious to a whole class of hardware failures
 
<ul>
<li>Power supply
 
</li>
<li>Power to the rack
 
</li>
<li>Network failure
 
</li>
</ul>
</li>
<li>Map/Reduce
 
</li>
<li>Bigtable
 
</li>
</ul>
<h3>Hypertable</h3>
<ul>
<li>Not relational
 
</li>
<li>Modeled after Google&#8216;s bigtable
 
</li>
<li>One big massive primary keyed table
 
</li>
<li>No transactions, maybe in the future
 
</li>
<li><b>Scalable</b>
 
</li>
<li><b>High Random insert, update, and delete rate</b>
 
</li>
<li>Loaded 1TB into a 9-node HT cluster, systained random insert @ 1M inserts
per second (Quad core Intel, 16GB RAM, SATA 3Gb/s).
 
</li>
</ul>
<h3>Data Model</h3>
<ul>
<li>Sparse, 2D talbe with cell versions
 
</li>
<li>1 table with 2 columns, next one has 1M, that&#8216;s OK
 
</li>
<li>4-part key
 
<ul>
<li>Row
 
</li>
<li>Column Family
 
</li>
<li>Column Qualifier
 
</li>
<li>Timestamp
 
</li>
</ul>
</li>
<li><em>Tim O&#8216;Reilly walks in and looks around for a seat, they&#8216;re
all taken</em>
 
</li>
</ul>
<h3>Anatomy of a key</h3>
<ul>
<li>Row key is \0 Terminated
 
</li>
<li>Col family is a single-byte (256 possible)
 
</li>
<li>Col qualifier is \0 terminated
 
</li>
<li>Timestamp is big-endian 1&#8216;s Comp. (memcmp, ordering has more recent
ahead of older versions)
 
</li>
</ul>
<h3>Concurrency</h3>
<ul>
<li>Bigtable uses Copy on write
 
</li>
<li>MVCC (like Couch) form in Hypertable. Deletes are inserted as delete
records. Multiple versions are kept around.
 
</li>
</ul>
<h3>Cellstore</h3>
<ul>
<li>65K blocks of compressed KV pairs
 
</li>
<li>Bloom Filter - booya!
 
</li>
</ul>
<h3>System Overview</h3>
<ul>
<li>Hyperspace has a distributed lock manager, and a small metadata fs (built
on BDB)
 
</li>
<li>Chubby (sp?) is google&#8216;s hyperspace
 
</li>
<li>Function of the master is to perform metadata operations (ALTER, CREATE,
etc.)
 
</li>
<li>Clients can communicate with Range servers
 
</li>
<li>Master can be down for a while with no one even noticing
 
</li>
<li>Hot standby design for availability
 
</li>
<li>Range Servers: Responsible for UPDATING and SCANNING
 
</li>
<li>All sits on top of HDFS distrubted FS
 
</li>
<li>Hadoop, KFS (GFS Clone)
 
</li>
</ul>
<h3>Range server</h3>
<ul>
<li>Manages ranges of table data
 
</li>
<li>Caches updates in memory (CellCache)
 
</li>
<li>Spills (compacts) periodically to update the disk (CellStore)
 
</li>
</ul>
<h4>Write ahead commit log</h4>
<ul>
<li>When updates come into a rangeserver, they&#8216;re written to a commit
log, then the data structures are updated so you can replay the log.
 
</li>
</ul>
<h4>Range meta-operation log</h4>
<ul>
<li>When a rangeserver does anything (moves, stops), it&#8216;s written into
the log
 
</li>
</ul>
<h2>Client API</h2>
<ul>
<li>C++ client is the only one supported ATM:
 
</li>
<li>You modify a table by creating a mutator
 
</li>
<li>You scan a table by creating a scanner
 
</li>
<li>Thrift Broker in the works
 
</li>
<li>Someone contrib&#8216;d a Hadoop Map/Reduce connector
 
</li>
</ul>
<h2>Compression</h2>
<ul>
<li>CellStore: compressed KV pairs
 
</li>
<li>Commit log: Compressed blocks (optionally)
 
</li>
<li>Supported types
 
<ul>
<li>zlib (fastest/best)
 
</li>
<li>lzo (high decomp speed)
 
</li>
<li>quicklz (fast decomp, high ratio)
 
</li>
<li>bmz (longest commons substring, lost of replication)
 
</li>
<li>none
 
</li>
</ul>
</li>
</ul>
<h2>Caching</h2>
<h3>Block Cache</h3>
<ul>
<li>CellStore blocks of KV pairs configurable
 
</li>
</ul>
<h3>Query cache</h3>
<ul>
<li>Not finished implementing
 
</li>
<li>Caches results
 
</li>
</ul>
<h3>Bloom Filter (!!)</h3>
<ul>
<li>Negative Cache
 
</li>
<li>Configurable K
 
</li>
<li>Allows you to find out if you definitely *don&#8216;t* have the data
 
</li>
</ul>
<h3>Scaling</h3>
<ul>
<li>Session table and crawl table
 
</li>
<li>Splits them all up into ranges, go to rangeservers
 
</li>
<li>Just add more machines, and the system migrates data equally
 
</li>
<li>Balancing is questionable&#8230;
 
</li>
</ul>
<h3>Access Groups</h3>
<ul>
<li>Control of physical layout hybrid row/col oriented
 
</li>
<li>Improves perf. by minimizing IO
 
</li>
<li>Grouping columns allows physical storage control
 
</li>
<li>Makes faster updates possible
 
</li>
</ul>
<h3>FS Broker</h3>
<ul>
<li>Can run on any distributed FS
 
</li>
<li>FUSE hooks
 
</li>
</ul>
<h2>More</h2>
<ul>
<li>Comparison to Hbase (Java, yuck), C++ much better
 
</li>
<li>System is designed for async communication
 
</li>
<li>Hypertable is CPU intensive
 
</li>
<li>Java uses 2-3 times the memory for large memmap
 
</li>
<li>Poor processor cache perf.
 
</li>
</ul>
<h2>Performance</h2>
<ul>
<li>AOL Query logs
 
</li>
<li>75,275,825 inserted cells
 
</li>
<li>8-node cluster (1 1.8 Ghz Dual Core Opteron)
 
<ul>
<li>4GB RAM
 
</li>
<li>3x 7200 SATA
 
</li>
</ul>
</li>
<li>Row Key 7B
 
</li>
<li>Avg value 15B
 
</li>
<li>Crap. Slide change
 
</li>
<li>Another test yielded oveer 1M sustained inserts/s
 
</li>
</ul>
<h2>Weaknesses</h2>
<ul>
<li>Range data managed by a single rangeserver
 
<ul>
<li>No data loss, but if it goes down, bad bad
 
</li>
<li>Can be mitigated with client-side cache or memcached
 
</li>
</ul>
</li>
</ul>
<h2>Status</h2>
<ul>
<li>Alpha, 0.9.0.7 released
 
</li>
<li>Beta at the end of August
 
</li>
<li>Waiting on Hadoop JIRA 1700
 
<ul>
<li>Bug in Hadoop, don&#8216;t allow appending to existing files
 
</li>
</ul>
</li>
<li>GPL 2
 
</li>
<li>Delete records get flushed in a &quot;major operation&quot;
 
</li>
</ul>
 
 
 
 
 
 
 
<h2>Classes</h2>
</body>
</html>
Files: 1
Classes: 0
Modules: 0
Methods: 0
Elapsed: 0.170s