hank / life

Good code.

This URL has Read+Write access

life / oscon / 2008 / sessions / Hadoop.EC2.html
100644 300 lines (223 sloc) 4.459 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
<!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: Hadoop.EC2.rdoc</h2>
<table>
  <tr><td>Path:</td><td>Hadoop.EC2.rdoc</td></tr>
  <tr><td>Modified:</td><td>Thu Jul 24 11:22:08 -0700 2008</td></tr>
</table>
 
<h1>OSCON 2008, Session 6: Hadoop and EC2</h1>
<h2>EC2</h2>
<ul>
<li>Virtualized Linux and Xen
 
</li>
<li>On demand
 
</li>
<li>Pro-rated
 
</li>
<li>EC2 = Computing
 
</li>
<li>S3 = Storage
 
</li>
</ul>
<h2>Hadoop</h2>
<ul>
<li>Framework supporting massively distributed applications
 
</li>
<li>Open Source Map/Reduce
 
</li>
<li>HDFS, Job Control, Programming Model, Self Healing, Failover, Monitoring,
Reporting - and it&#8216;s simple
 
</li>
</ul>
<h2>Problem</h2>
<ul>
<li>1851-1922 historical archive
 
</li>
<li>Free and open is better
 
</li>
<li>Articles served as PDFs
 
</li>
<li>Free = More Traffic
 
</li>
<li>Really need 1851-1981 PDFs
 
</li>
<li>PDFs dynamically generated
 
</li>
<li>Real deadline
 
</li>
</ul>
<h3>Background</h3>
<ul>
<li>Articles are and image of the newspaper
 
</li>
<li>Some poor shmuck has to draw rectangles around the parts of the article
 
</li>
<li>Create metadata
 
</li>
<li>Stitch all of it together
 
</li>
</ul>
<h3>Simple answer</h3>
<ul>
<li>We could pregenerate 11 million PDFs and serve them out
 
</li>
<li>Copy all the source data to S3
 
</li>
<li>EC2 instnaces and Hadoop generate the PDFs
 
</li>
<li>Store the output PDFs back in S3
 
</li>
<li><b>Hope that S3 never goes down</b>
 
</li>
</ul>
<h3>Data</h3>
<ul>
<li>4.3 TB of data
 
</li>
<li>20M files, TIFFs, metadata
 
</li>
<li>cp data amazons3
 
</li>
<li>simple if you have big bandwidth
 
</li>
</ul>
<h3>It works</h3>
<ul>
<li>There&#8216;s no interdependency among articles
 
</li>
<li>Parallelizable
 
</li>
<li>Not really using the Reduce functionality in Map/Reduce
 
</li>
</ul>
<h3>Non-Hadoop Specific code</h3>
<ul>
<li>Suck in metadata file, parse it
 
</li>
<li>Load TIFFs, scale em
 
</li>
<li>Arrange, combine, generate
 
</li>
<li>Store
 
</li>
</ul>
<h3>IO notes on Hadoop</h3>
<ul>
<li>Minimal use of HDFS
 
</li>
</ul>
<pre>
 - Simplified by S3 usage
 - HDFS in an EC2 on-demand environment
</pre>
<h3>Map/Reduce Programming model</h3>
<ul>
<li>Input KV pair, output KV pair
 
</li>
<li>Reduce takes a Key and a list of values associated with the key, outputs a
single KV pair
 
</li>
</ul>
<h3>Hadoopize the PDF generator</h3>
<ul>
<li>Simply put the previous PDF code inside the map class
 
</li>
<li>Use a reporter to indicate job success/failure
 
</li>
</ul>
<h3>Reduce class</h3>
<ul>
<li>If I have a key and an iterator, I just iterate through the list and add,
then write.
 
</li>
</ul>
<h3>Run</h3>
<ul>
<li>Xen images with Hadoop preconfigured
 
</li>
<li>Bundle, Upload, Register Images with EC2
 
</li>
<li>Boot Master Node
 
</li>
<li>Boot all slaves
 
</li>
<li>Check Hadoop management console
 
</li>
<li>Submit a job request
 
</li>
<li>4TB of data in 24 hours using 100 computers
 
</li>
<li>Produced another 1.5 TB of data, 11 million PDFs
 
</li>
<li>Cost - $240 for computing, $650 for storing the data
 
</li>
</ul>
<h3>Error!</h3>
<ul>
<li>Off by 1 error, Java and the Date class <b>JAVA FAIL</b>
 
</li>
<li>They re-ran the data
 
</li>
</ul>
<h2>TimesMachine</h2>
<ul>
<li>We have all this cool data that&#8216;s never been very accessible
 
</li>
<li>Date-based browsable archive of full-page image scans
 
</li>
<li>Possible because it was cheap and self-service
 
</li>
<li><a
href="http://timesmachine.nytimes.com/browser">timesmachine.nytimes.com/browser</a>
 
</li>
</ul>
<h2>Other Projects</h2>
<ul>
<li>Data mining
 
</li>
<li>Article Clustering (15 million articles)
 
</li>
<li>Other secret ones&#8230;
 
</li>
</ul>
<h2>Question time</h2>
<ul>
<li>Do you OCR?
 
<ul>
<li>Yes, the articles are OCRed.
 
</li>
</ul>
</li>
<li>How much are you concerned about security sending blogs into the cloud
 
<ul>
<li>Article data isn&#8216;t a concern, but there are extra precautions with
blogs, personal information worries.
 
</li>
</ul>
</li>
<li>Can you say what you&#8216;re doing to protect the cloud?
 
<ul>
<li>No, not really, no.
 
</li>
</ul>
</li>
<li>What about having something like google trends for words
 
<ul>
<li>Sounds great, you want a job?
 
</li>
</ul>
</li>
</ul>
 
 
 
 
 
 
 
<h2>Classes</h2>
</body>
</html>
Files: 1
Classes: 0
Modules: 0
Methods: 0
Elapsed: 0.132s