- 1. ログ解析を支えるNoSQLの技術 川上 知成 Drecom Co., Ltd12/02/20 © Drecom Co.,Ltd. All rights Reserved
- 2. 自己紹介• 川上 知成• @tomofusa• 株式会社ドリコム• ソーシャルゲーム事業本部• ICTデザイン部 ICTグループ長 • ソーシャルゲーム開発を経て – アーキテクトグループのマネジメント12/02/20 © Drecom Co.,Ltd. All rights Reserved 2
- 3. ソーシャルゲームの ログ解析とは?12/02/20 © Drecom Co.,Ltd. All rights Reserved 3
- 4. アクセスする目的が明確12/02/20 © Drecom Co.,Ltd. All rights Reserved 4
- 5. ゲームを遊ぶ12/02/20 © Drecom Co.,Ltd. All rights Reserved 5
- 6. PV Action 取得するログ12/02/20 © Drecom Co.,Ltd. All rights Reserved 6
- 7. PV Action ( x N ) 取得するログの種類12/02/20 © Drecom Co.,Ltd. All rights Reserved 7
- 8. PV Action ( x N ) 取得するログの種類 日:1∼2億PV レコード 月: 50億PV レコード 例:アクセスログのみ12/02/20 © Drecom Co.,Ltd. All rights Reserved 8
- 9. 日:1∼2億PV レコード 月: 50億PV レコード 例:アクセスログ RDBMSでギリギリ計算可能? 蓄積データを含めた解析は 容量に限界がある 計算時間がリニアに増加12/02/20 © Drecom Co.,Ltd. All rights Reserved 9
- 10. NoSQLを利用12/02/20 © Drecom Co.,Ltd. All rights Reserved 10
- 11. NoSQLとは?12/02/20 © Drecom Co.,Ltd. All rights Reserved 11
- 12. NoSQL?• Not Only SQL• NoSQLとは、 RDBMS以外のデータベース管理システム を指し、 RDBMSの長い歴史を打破するものとして、 広い意味での関係モデル以外に属するデー タベースの発展を促進させようとする運動 である。 (wikipediaより抜粋)12/02/20 © Drecom Co.,Ltd. All rights Reserved 12
- 13. NoSQL?特徴:• データストアによって多種多様な特徴 – 揮発性、不揮発性 – スキーマレス – Joinの有無 – トランザクションの有無• SQLに比べてシンプル、しかし高性能• スケーラビリティ、分散処理に対応しやすい 構成をとっている ものも12/02/20 © Drecom Co.,Ltd. All rights Reserved 13
- 14. 弊社で利用しているNoSQL種類 データ特徴 用途Memcached*1 揮発性 Session, cacheTokyoTyrant*2 不揮発性 Session, cacheKyotoTycoon 不揮発性, Dual-MasterSession, cacheRedis 不揮発性, Queue, cache, Master-Slave(Cluster) Sorted SetHadoop 大規模分散Storage Log保存 *1 一部利用、移行中 *2 現在は利用していない12/02/20 © Drecom Co.,Ltd. All rights Reserved 14
- 15. SocialGame50億PVのログ解析 Hadoopを使った仕組み データ分析システム基盤 Aguri12/02/20 © Drecom Co.,Ltd. All rights Reserved 15
- 16. ※今回は分析軸は対象とせず、 仕組みのみを話します。12/02/20 © Drecom Co.,Ltd. All rights Reserved 16
- 17. Aguriとは• 目的: – ソーシャルアプリのログ収集 – ログ蓄積 – ログ解析によるKPI算出 – アプリへフィードバックし、Actionプランへ12/02/20 © Drecom Co.,Ltd. All rights Reserved 17
- 18. Aguriとは• 究極目標: Data Driven Auto Optimize• 例: 1. リンク色を複数、ユーザによって出し分け 2. 最適なリンク色の抽出 特定個人に依存する意思決定ポイントの減少12/02/20 © Drecom Co.,Ltd. All rights Reserved 18
- 19. Aguri::IOINPUT• アプリの各種ログデータOUTPUT• メールレポート• ディスプレイ – Web管理画面• RDBMS12/02/20 © Drecom Co.,Ltd. All rights Reserved 19
- 20. Aguri::System• Scribe:2.2.1 *1 – boost 1.43.0, fb303 0.5.0 thrift 0.5.0 libhdfsで書き込み – https://github.com/facebook/scribe• Hadoop:cdh2 (Clouderas Distribution for Hadoop) *2• Batch: – Java Mapreduce – Ruby hadoop streaming *1 再送の仕組み *2 容量の冗長性を担保※その他の中間処理などはRuby12/02/20 © Drecom Co.,Ltd. All rights Reserved 20
- 21. Aguri::Overview hadoop MapReduce Web UI Hadoop DFS Log Files. Summery Data. Thrift Scribe Display Mail Logfile Collection view Social Game Application RDBMS12/02/20 © Drecom Co.,Ltd. All rights Reserved 21
- 22. ログ収集 • Pull型収集app Log – LogServerで Server Appの追加漏れapp – LogServerが SPOF(取得漏れapp は、手動で) OUTPUTapp12/02/20 © Drecom Co.,Ltd. All rights Reserved 22
- 23. ログ収集 • Push型収集app – App側で scribe LogServerを指定app Scribe – ScribeServerが Server Scribe SPOFだが、 scribe Server Bufferと再送でapp scribe 可用性UP hadoopapp scribe OUTPUT12/02/20 © Drecom Co.,Ltd. All rights Reserved 23
- 24. Aguri::Log • 独自フォーマットを規定 – 1次処理(クレンジング)の省略 – 例:アクセスログ 12/02/20 © Drecom Co.,Ltd. All rights Reserved 24
- 25. Aguri::Batch• Java:MapReduce – メリット:高速、チューニング可 – デメリット:開発コストが高い (coding環境, compile)• Ruby:Hadoop Streamingを利用 – メリット:サーバサイドで完結。 – デメリット:遅い 定型処理はJava。試行錯誤はRuby。12/02/20 © Drecom Co.,Ltd. All rights Reserved 25
- 26. Aguri::Batch• mrtoolkit – Ruby製 mapreduceツール – NY TimesがGNU GPL v3で公開 – http://code.google.com/p/mrtoolkit/12/02/20 © Drecom Co.,Ltd. All rights Reserved 26
- 27. Aguri::Batch• Sample code – IP別PVの算出12/02/20 © Drecom Co.,Ltd. All rights Reserved 27
- 28. Aguri::History• システムの変遷 – 2010/9 テストローンチ – 2010/12 Aguriへ移行(pull型より) 以後、本格稼働 – 2011/4頃 中期構成 – 2011/9頃 現在構成12/02/20 © Drecom Co.,Ltd. All rights Reserved 28
- 29. Aguri::History – 初期構成:最小構成のためmasternode同居 • 3node: capacity 1TB scribe Master Slave Slave Slave name data data job task task data task12/02/20 © Drecom Co.,Ltd. All rights Reserved 29
- 30. Aguri::History – 中期構成:masternodeが分離, Slave追加 • 5node: capacity 3TB scribe Master slave Slave Slave Slave name data data data data job task task task task12/02/20 © Drecom Co.,Ltd. All rights Reserved 30
- 31. Aguri::History – 現在の構成:masternode scaleup引越し • 9node: capacity 12TBscribe scribe Scribe Master slave Slave Slave SlaveLocal disk name data data data data job task task task task slave Slave Slave Slave12/02/20 © Drecom Co.,Ltd. All rights Reserved 31
- 32. Aguri::History• Hdfsデータcapacity – 8 datanode: 12TB• Used 6TB – ログ(gz圧縮済み、圧縮率10 20%) – 集計・解析データ12/02/20 © Drecom Co.,Ltd. All rights Reserved 32
- 33. Aguri::Result• 定期実行 – Hourly: 速報値をレポート – Daily: レポートとディスプレイ – Weekly: 蓄積データから解析レポート 重要な定期出力KPIはRDBMSへ• 不定期 – 解析は随時12/02/20 © Drecom Co.,Ltd. All rights Reserved 33
- 34. Aguri::Result• アプリ毎に共通指標で予実を確認• アプリチームの業務/システム負荷軽減 – ログ収集・集計の手間 – 集計時のIO, メモリなど各種システムリソース12/02/20 © Drecom Co.,Ltd. All rights Reserved 34
- 35. より柔軟に• アプリ個別にレポート – resque-scheduler gem (Redis) • 仕様変更に合わせた集計 • より詳細なデータ取得 を取得可能12/02/20 © Drecom Co.,Ltd. All rights Reserved 35
- 36. 専任分析チーム• アプリDBの利用 – DBの定期backupデータrestore環境を用意 – 大規模RDBMSからデータを抽出 • 1.2TB ioDrive Duo by Fusion-io12/02/20 © Drecom Co.,Ltd. All rights Reserved 36
- 37. 専任分析チーム• 解析ソフト:某有償解析ツールの利用 – DB抽出データとAguri抽出データを 組み合わせて解析 • ユーザ行動分析 • イベント効果分析12/02/20 © Drecom Co.,Ltd. All rights Reserved 37
- 38. 専任分析チーム• ユーザ行動/イベント効果分析 – パラメータチューニングにまで落とし込み12/02/20 © Drecom Co.,Ltd. All rights Reserved 38
- 39. 専任分析チームP:イベント企画D:イベント実施C:イベント効果分析 – KPI分析 – パラメータチューニング提案A:アプリイベント改善策立案 – 次回パラメータ改善へ12/02/20 © Drecom Co.,Ltd. All rights Reserved 39
- 40. まとめ• 弊社のログ解析と利用NoSQLについて• Aguriについて• 分析利用事例を紹介12/02/20 © Drecom Co.,Ltd. All rights Reserved 40
- 41. 12/02/20 © Drecom Co.,Ltd. All rights Reserved 41
- 42. 【PR】• データ分析基盤システムに興味のある方• ソーシャルゲームの分析をやってみたい方• 大規模ログ解析をしてみたい方を募集しまています。12/02/20 © Drecom Co.,Ltd. All rights Reserved 42
- 43. 【PR】 一緒にデータをゴリゴリ解析し、 を見つけましょう。12/02/20 © Drecom Co.,Ltd. All rights Reserved 43
- 44. ご清聴ありがとうございました12/02/20 © Drecom Co.,Ltd. All rights Reserved 44