NoSQL East 2009 – Summary of Day 2
From <http://journal.uggedal.com/>
なんとなく、そんな気はしていたのですが、Twitter も Hadooper のようです。NoSQL East 2009 という刺激的な名前のカンファレンスで、同社の Kevin Weil 氏が、その利用方法について、Pig のメリットも含めて語ったとのことです。
Data is getting big. NYSE produces 1TB of data every day, Facebook produces 20TB+ of compressed data each day, and CERN produces 40TB each day (15PB each year). This creates a need for multiple machines and horizontal scalability.
データの大容量化はとまらない。 NYSE は毎日 1TB のデータを吐き出し、Facebook は毎日 20TB+ の圧縮データを作り出し、CERN は毎日 40TB(年間で 15PB)のデータを生じている。 それにより、マルチ・マシンによる水平的なスケーラビリティへのニーズが生まれる。
Hadoop is two things: a distributed file system and a map/reduce framework for parallel computation. The file system is fault-tolerant, replicated, and handles node failure. If it’s hard to store a PB it’s even harder to compute a PB. Yahoo is the largest user of Hadoop.
Hadoop は 2つの要素で構成される。 つまり、パラレル・コンピューティングのための、分散ファイル・システムとMar/Reduce フレームワークである。 このファイル・システムは、フォールと・トレラントとリプリケーション、そしてノードでの障害に対応する。 P Bytes のストアが困難なら、P Bytes のコンピューティングは更に困難になるが、現実として Yahoo は Haoop の最大のユーザーである。
Map/reduce at twitter: how many tweets per user, given tweets table?
Twitter における Map/Reduce : ユーザごとにいくつ tweet がある? つまり、前提となるテーブルは?
Input: key=row, value=tweet_info.
Map: output key=user_id, value=1.
Shuffle: sort by user_id (so that one can use more than one reducer).
Reduce: for each user_id, sum.
Output: user_id, tweet count.
With 2x machines this job runs just about 2x faster.
この処理に、2倍のマシンを与えれば、約 2倍の速度が得られる。
The problem with Hadoop is that analysis is typically written in Java. It’s single-input, two-stage data flow (map, then reduce) is rigid. Joins (distributed) are also hard to do in Hadoop. Java is simply to verbose for writing map/reduce jobs. Lastly, rapid prototyping and exploration is hindered by compilation.
Hadoop における問題とは、その解析部分が、一般的には Java で記述されていることである。 その single-input と two-stage のデータ・フローは、固定的なものである。 さらに、join(distributed)も、Hadoop の中で行うのは困難である。 簡潔に言って Java は、Map/Reduce 処理を記述するには冗長である。 さらに言えば、プロトタイピングや調査が、コンパイルにより影響を受けてしまう。
Pig is a high level language that can be easily read. You think about data as transformations on sets of records. You do one transformation at a time so that you just have to think about the next step. This leads to fewer errors. Pig helps Twitter understand their business faster.
Pig は、可読性の高い、ハイレベル言語である。また、レコード・セットの transformations として、データを取り扱うことができる。 一度に、一回の transformation を実行することで、次のステップへと確実に移行できる。 この方式により、エラーを減らせる。 Twitter は Pig の支援を得ることで、そのビジネスを加速させる方式を理解した。
Kevin Weil talks about Pig. Picture taken by Paul Stamatiou.
Pig makes it easier for non programmers to do large-scale data analysis. It’s easily learnable for people who know SQL. An example analytic script from Twitter is 5% the code and took 5% of the time of writing compared to straight Hadoop. Execution time is roughly 50% of Hadoop.
Pig により、プログラマーでなくても、ラージ・スケールのデータ解析が容易になる。 SQL を知っている人にとって、その学習は容易である。 Twitter における分析スクリプトを例にすると、Hadoop をダイレクトに操作する場合と比較して、5% のコードと、5% の時間で、その記述が完了している。 また、実行時間に関しては、おおよそで Hadoop の 50% になっている。
At Twitter they run Cloudera’s free distribution of Hadoop 0.20.1, with a heavily modified Scribe installation for log collection straight to HDFS, and heavily modified LZO code for fast and splittable data compression. Data is then stored as either LZO-compressed flat files or serialized, LZO-compressed protocol buffers.
Twitter では、 Cloudera の free distribution of Hadoop 0.20.1 を利用し、ログ・コレクションを HDFS にダイレクトに吐き出すために、Scribe インストレーションを大幅に修正している。 さらに、データ圧縮の高速化と、分割処理のために、LZO コードも大幅に変更している。
Semi structured data at Twitter are: apache logs, search logs, RoR logs, MySQL logs, rate limiter logs, per-application logs. Structured data are: tweets, users, block notifications, phones, saved searches, retweets, authentication, SMS usage, third party clients, followings. Entangled data: the social graph (doesn’t really lend itself to be map/reduced).
Twitter の セミ・ストラクチャード・データは: apache logs/search logs/RoR logs/MySQL logs/rate limiter logs/per-application logs で構成されている。 また、ストラクチャード・データは: tweets/users/block notifications/phones/saved searches/retweets/authentication/SMS usage/third party clients などで構成される。 そして、それらを取りまとめるデータが、social graph である(それ自体は、Map/Reduce されない)。
Pig is good at counting big data with standard counts, min, max, std dev. “What get measured gets improved”. Examples at Twitter are:
- How many request do we serve each day.
- What is the average latency? 95% latency?
- Grouped by response code: what is the hourly distribution?
- How many searches happen each day at Twitter?
- Where do they come from?
- How many unique queries?
- How many unique users?
- Geographic distribution?
Correlating big data with probabilities, covariance, influence. Examples at Twitter are:
- How does usage differ for mobile users?
- How does usage differ for 3rd party desktop client users?
- Cohort analysis: all users who signed up on the same day—then see how they differ over time.
- Site problems: what goes wrong at the same time?
- Which features get users hooked?
- Which features do successful users use often?
- Search corrections and suggestions (not done now at Twitter, but coming in the feature).
- A/B testing.
Research on Big data: prediction, graph analysis, natural language. Examples at Twitter are:
- What can web tell about a user from their tweets?
- What can we tell about you from the tweets of those you follow?
- What can we tell about you from the tweets of your followers?
- What can we tell about you from the ratio of your followers/following?
- What graph structures lead to successful networks? (Twitter’s graph structure is interesting since it’s not two-way)
- Sentiment analysis (you can predict the success of a movie by following its mentions on Twitter the first days after its release).
- What features get a tweet retweeted?
- When a tweet is retweeted, how deep is the corresponding retweet three?
- Long-term duplicate detection (short term for abuse and stopping spammers)
- Machine learning. About not quite knowing the right questions to ask at first. How do we cluster users?
- Language detection (contact mobile providers to get SMS deals for users—focusing on the most popular countries at first).
- How can we detect bots and other non-human tweeters?
———————–
こちらも ど~ぞ。
http://www.slideshare.net/kevinweil/hadoop-pig-and-twitter-nosql-east-2009
ちなみに、このコンテンツは、http://twitter.com/Nakada_itpro さんの "NoSQL EAST 2009 行きたい" 電波にしびれ、さらに、http://twitter.com/shot6 さんの "意味深ツブヤキ” に対して、"教えて君” と化した http://twitter.com/Agile_Cat が食い下がった結果として、発見されたものです ーーー A.C.
<関連>
Hadoop DFS _ Introduction



























