Why Europe’s Largest Ad Targeting Platform Uses Hadoop_3
by Ed Albanese March 10, 2010
http://www.cloudera.com/blog/2010/03/why-europes-largest-ad-targeting-platform-uses-hadoop/

Development Begins
In June 2009 we started to develop a full solution. At this point certain external factors played a very helpful role in our development. One was the publication of the book “Hadoop: The Definitive Guide” by Tom White, which helped us to understand how we could use Hadoop. The other was the emergence of a dynamic programming language called Clojure, which compiles directly to JVM byte code.
そして、2009年 6月には、すべてのソリューションの再開発に着手しました。 そのとき、Tom White による “Hadoop: The Definitive Guide” が出版されるという、私たちの Hadoop への理解を推進する出来事がありました。また、JVM バイトコードへとダイレクトにコンパイルする、Clojure と呼ばれるダイナミック・プログラム言語も出現しました。
After one month of development we were able to create our reports using Hadoop with our processing times going from five days to one hour. This was great for building confidence in our decision. For the following four months we progressively turned features off in the old data warehouse as they became available in Hadoop. By October 2009 we had completed the migration and also additional new features previously impossible to run. In the next section I will briefly explain how it actually works.
1ヶ月の開発期間の後に、Hadoop を用いたレポート生成が可能になりましたが、その処理時間が 5日間から 1時間に短縮されたのです。それにより、私たちの判断に大きな自信が生まれてきました。それから 4ヶ月の間に、漸進的に Hadoop へと機能を移行し、古いデータウエア・ハウスを停止していきました。 そして 2009年10月には完全な移行を達成した上に、それまでは実現できなかった新しい機能を付け加えました。 次のセクションでは、私たちが行ってきたことを簡潔に説明していきます。
A Closer Look at our Hadoop Setup
Our cluster is located in one of our data centers and contains commodity machines with a total of 36 cores and 8 TB of disk space. The machines were provisioned using Chef from Opscode.com and we use the Cloudera CDH1 distribution.
私たちのデータセンターの1つに、このクラスタは配置されており、合計で 36コアの CUPと 8TB のディスク・スペースを有する、コモディティ・マシンで構成されています。それらのマシンでは、Cloudera CDH1 ディストリビューションを採用し、Opscode.com の Chef を用いたプロビジョニングを行っています。
The log files are now copied to the HDFS. In order to make sense of our data we need it summarized by hours, days and weeks. Therefore, we organize our HDFS directory structure hierarchically by date to reflect this requirement. The path for handling days and hours follows the structure /event/years/months/days/hours. This way we can use simple file globs for a MapReduce job input file configuration.
現時点において、ログ・ファイルは HDFS にコピーされています。 私たちのデータの意味を理解するためには、時間/日/週のレベルでの処理が必要になります。 したがって、こうした要件を反映するために、HDFS ディレクトリ階層構造を、日付を用いて構成するようにしました。「日」 や 「時間」 を取り扱うパスは、/event/years/months/days/hours という順に並びます。 そうすることで、MapReduce ジョブ入力ファイル・コンフィグレーションのための、シンプルで細かく分類されたファイルを利用できます。
We wrote our own simple scheduler querying the HDFS to see, if input is available to create missing output. When it cannot find the output a configuration is created containing input and output path which is sent to our MapReduce server.
また、出力を達成できないような入力が存在するのかどうか、その点を確認するために、HDFS に対するシンプルでスケジューリングされたクエリーを記述しました。 そして、出力が見つからない時には、MapReduce サーバーに送信する入出力パスを含んだ、コンフィグレーションを作成するようにしました。
The MapReduce server provides a JSON HTTP API for starting, querying and stopping jobs. It supports both scheduled and on-demand jobs. When the server receives a request to run a job, the event name is used to locate the associated chain of one or more Hadoop jobs to run. A unique identifier is returned which can be later used to query or stop the job.
私たちの MapReduce サーバーは、ジョブの始動/クエリー/停止のために、JSON HTTP API を提供します。そこでは、スケジュールされたジョブと、オンデマンドのジョブの双方がサポートされます。ジョブ実行のリクエストをサーバーが受信するときには、関連して実行される他の Hadoop ジョブを指し示すために、イベントの名称が用いられます。そして、後にジョブに対するクエリーや停止のための使用される、ユニークな ID が返されます。
An example is the chain of events to run one of our daily reports. Customer-wise it contains a summary of page impressions and unique clients for each socio-demographic and product interest prediction our online platform produces. Therefore, we first fetch information stored in our customer database and add this to the distributed cache. The MapReduce phase sums up the page impressions for each user and counts the number of client ids for each prediction and possible outcome e.g. age class 30-39. The final phase is to perform a reduce side join where the internal customer ids are translated to account manager readable information by accessing the data previously stored in the distributed cache.
例として、私たちのデイリー・レポートの、一部を実行するイベントの連鎖があります。 顧客の観点からすると、そこには、私たちのオンライン・プラットフォームが作り出す、それぞれの製品への興味と購買層の予測に関する、ページ・インプレッションと個々のクライアントのサマリーが含まれます。 したがって、顧客データベースにストアされた情報を最初にフェッチし、それを分散キャッシュに加えていきます。 MapReduce フェーズでは、それぞれのユーザーごとのページ・インプレッションを加算し、個々の予測と可能性の結果(age class 30-39 など)ごとに、クライアント ID の数を数えていきます。 最終フェーズとして、以前に分散キャッシュにストアされたデータにアクセスします。そして、内部情報である顧客 ID を、アカウント・マネージャーが読める情報に変換する、Reduce サイドの join を実行します。
At a later point we intend to use the MapReduce server API to build a web based interface fitting our purposes.
今後ですが、この目的に適してた Web ベースのインターフェイスを構築するために、MapReduce サーバー API を使うつもりです。
Frequently-run jobs are implemented in Clojure and Java using the Hadoop MapReduce API with a number of performance optimizations. These are:
頻繁に実行されるジョブは、Hadoop MapReduce API を用いて Clojure と Java で実装されますが、数多くのパフォーマンスの最適化をともないます。
• Compress map output to LZO, mainly to reduce disk IO during the shuffle phase
• Apply a Combiner to perform initial aggregation before the data arrives at the reducer
• Use our own developed Writable types which are written to be RawComparators
• Add type hints with Clojure code to avoid the overhead of reflection
• Map 出力を LZO に圧縮し、主として Shuffle フェーズのディスク I/O を低減。
• データが Reducer に到着する前に、最初のアグリゲーションを実行するために Combiner を適用。
• RawComparators になるように記述された、独自開発の Writable types を使用。
• リフレクションのオーバーヘッドを回避するために、Clojure を用いた type hints を追加。
Also we use tools like Pig to run ad hoc reports as well as streaming jobs e.g. to grep the contents of the web servers logs.
さらに、アドホックなレポートを実行するための、Pig のようなツールを使うだけではなく、たとえば、Web サーバー・ログのコンテンツを grep するための、ストリーミング・ジョブも利用します。
Spreadsheets are often used by our statisticians and account managers as a tool to analyze data. Therefore, we wrote an OutputFormat class which generates Excel work books with a number of sheets summarizing customer data.
統計学者とアカウント・マネージャーが実施する、データ分析のツールとして、スプレッドシートが頻繁に使用されます。 そのため、顧客データを要約する多数のシートを用いた、Excel ワークブックを生成するための、OutputFormat クラスを記述しました。
<続く>
ーーーーー
次は最終回で~~~す ーーー A.C.
<関連>
Hadoop による Web 広告システムの構築と運用 :ヨーロッパでの事例_1
Hadoop による Web 広告システムの構築と運用 :ヨーロッパでの事例_2
Hadoop による Web 広告システムの構築と運用 :ヨーロッパでの事例_3
Hadoop による Web 広告システムの構築と運用 :ヨーロッパでの事例_4



























