Post on 06-May-2015
AmebaPiggの裏側
2011年5月16日月曜日
自己紹介
2011年5月16日月曜日
渡辺 雄作(32) / @waysaku株式会社サイバーエージェントアメーバ事業本部所属
2006年中途入社前職は金融•証券系のSIerのプログラマーアメーバ関連開発を経て、現在はAmebaPiggのシステム開発責任者
2011年5月16日月曜日
渡辺 雄作(32) / @waysaku株式会社サイバーエージェントアメーバ事業本部所属
2006年中途入社前職は金融•証券系のSIerのプログラマーアメーバ関連開発を経て、現在はAmebaPiggのシステム開発責任者
元
2011年5月16日月曜日
AmebaPiggとは?
2011年5月16日月曜日
2009年2月に開始した仮想空間サービス
現在は400万人以上のユーザーが利用する仮想空間へと成長
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
6割の売上を占める主要サービス
2011年5月16日月曜日
システムアーキテクチャ
•求められている要件•システム仕様
2011年5月16日月曜日
求められている要件
2011年5月16日月曜日
求められている要件大量リクエスト処理
2011年5月16日月曜日
求められている要件大量リクエスト処理スケーラビリティ
2011年5月16日月曜日
求められている要件
リアルタイム性
大量リクエスト処理スケーラビリティ
2011年5月16日月曜日
求められている要件
リアルタイム性イベント駆動(Push配信)
大量リクエスト処理スケーラビリティ
2011年5月16日月曜日
求められている要件
リアルタイム性イベント駆動(Push配信)
大量リクエスト処理スケーラビリティ
ブラウザで動く
2011年5月16日月曜日
求められている要件
リアルタイム性イベント駆動(Push配信)
大量リクエスト処理スケーラビリティ
ミニマムスタート(予算的な意味で)
ブラウザで動く
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
swfやimgの配信
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ユーザー情報のやり取り
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
チャットデータのやり取り
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
チャット+
ゲーム情報のやりとり
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ピグの基盤DB
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ユーザーswfなどを格納
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
ログデータの簡単な解析
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
システム仕様
2011年5月16日月曜日
クライアント
2011年5月16日月曜日
クライアント
ActionScript3+
独自開発フレームワーク
2011年5月16日月曜日
クライアント
ActionScript3+
独自開発フレームワーク複数人開発を意識したモジュール化
Dynamic Module LoadingDependency Injection
各種ライブラリのチューニング(LinkedListのチューニングなど)
2011年5月16日月曜日
main.swf
core.swcソケット通信などのフレームワーク
profile.swf
room.swf
casino.swf
fishing.swf
shop.swf
main.swf各モジュールへのインターフェースを
定義
2011年5月16日月曜日
main.swf
core.swcソケット通信などのフレームワーク
profile.swf
room.swf
casino.swf
fishing.swf
shop.swf
main.swf各モジュールへのインターフェースを
定義
イベント発生時に動的にswfをロードする
2011年5月16日月曜日
サーバ(socket)
2011年5月16日月曜日
サーバ(socket)
Java+
独自開発フレームワーク
2011年5月16日月曜日
サーバ(socket)
Java+
独自開発フレームワークノンブロッキングIOを使った軽量データ(コマンド)処理サーバ
独自プロトコルによるステートフル通信
2011年5月16日月曜日
<interface>Command
コマンド処理
<interface>Command
コマンド処理
送信したいデータをバイトデータにシリアライズ
AS3、pythonで実装済
server client
2011年5月16日月曜日
データストア
2011年5月16日月曜日
データストア
IndexPersister(Java)+
MySQL
2011年5月16日月曜日
データストア
IndexPersister(Java)+
MySQL
オブジェクトをバイナリでMySQLに保存MySQLはKeyValueストアとして利用するのみ
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
Key : ValueuserId : userId + name + enable
シリアライズ
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
Key : ValueuserId : userId + name + enable
シリアライズ
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
Key : ValueuserId : userId + name + enable
シリアライズ
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
Key : ValueuserId : userId + name + enable
シリアライズ
2011年5月16日月曜日
IndexPersister@Persistable("address")
public class Address {
private int userId; private String name;; private byte enable;
@IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getName() { return name; } @Store(index=2) public byte getEnable() { return status; }
Key : ValueuserId : userId + name + enable
シリアライズ
2011年5月16日月曜日
IndexPersister
2011年5月16日月曜日
IndexPersister
複数の型のシリアライズに対応
2011年5月16日月曜日
IndexPersister
複数の型のシリアライズに対応データ互換性保持
2011年5月16日月曜日
IndexPersister
複数の型のシリアライズに対応データ互換性保持中間キャッシュ
2011年5月16日月曜日
IndexPersister
複数の型のシリアライズに対応データ互換性保持中間キャッシュデータ圧縮
2011年5月16日月曜日
IndexPersister
複数の型のシリアライズに対応データ互換性保持中間キャッシュデータ圧縮複合キー生成
2011年5月16日月曜日
IndexPersisterバイナリで保存するメリット
2011年5月16日月曜日
IndexPersisterバイナリで保存するメリット
データストアに依存しない
indexPersister Interface
NDIpersister
MySQL persister
MongoDB persister
その他
byte[] : byte[]
varbinary : longblob
バイナリ形式が保存できればOK
Application
2011年5月16日月曜日
MySQLの利用方法Key Valueストアとして利用
`key` varbinary(255) NOT NULL`value` longblob NOT NULL
2011年5月16日月曜日
MySQLの利用方法Key Valueストアとして利用
`key` varbinary(255) NOT NULL`value` longblob NOT NULL
Amebaで実績のあるMySQLの安定性•信頼性社内のMySQLの運用ノウハウを利用可能
I/O性能対策にI/O Accerarator(FusionIO)を採用
2011年5月16日月曜日
運用•工夫について•開発体制•システムパフォーマンス•サーバの物理設計•行動ログの保存•永続化レイヤーのリプレイス
2011年5月16日月曜日
開発体制(立ち上げ)プロデューサ
エンジニア
Flashクリエイター
デザイナー
2011年5月16日月曜日
開発体制(現在)
プロデューサ
エンジニア
Flashクリエイター
デザイナーイラストレータークリエイティブディレクター
2011年5月16日月曜日
パフォーマンスなど
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ソケットサーバへの同時接続数
10万同時接続(ピーク時)
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ソケットサーバへの同時接続数
10万同時接続(ピーク時)トラフィック
2.2Gbps(ピーク時)
2011年5月16日月曜日
Flash(ActionScript3)
web-app server info-socket-server chat-socket-server game-socket-server
hadoop cluster
memcached
File Store Cluster
memcached
MySQL
ソケットサーバへの同時接続数
10万同時接続(ピーク時)トラフィック
2.2Gbps(ピーク時)
秒間クエリ(Query Per Second)
14万QPS
30万QPS
2011年5月16日月曜日
サーバ物理設計
2011年5月16日月曜日
サーバ物理設計
2011年5月16日月曜日
サーバ物理設計
CPU性能はあまり必要ない
2011年5月16日月曜日
サーバ物理設計
CPU性能はあまり必要ない省電力
2011年5月16日月曜日
サーバ物理設計
CPU性能はあまり必要ない省電力省スペース
2011年5月16日月曜日
サーバ物理設計
安い
CPU性能はあまり必要ない省電力省スペース
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
2011年5月16日月曜日
ユーザー行動ログの保存
2011年5月16日月曜日
保存しているログの種類
ログイン•ログアウト移動チャット手紙•メッセンジャー着替え•顔変更ぴぐとも
部活カメラ•アイテム消費ペットゲームetc...
2011年5月16日月曜日
保存しているログの種類
ログイン•ログアウト移動チャット手紙•メッセンジャー着替え•顔変更ぴぐとも
部活カメラ•アイテム消費ペットゲームetc...
取得している行動ログは100種類程度約3GB/dayのログを収集
デイリーでラボチームにもデータ転送
2011年5月16日月曜日
永続化レイヤーのリプレイス
2011年5月16日月曜日
web-app server info-socket-server chat-socket-server game-socket-server
MySQLhadoop cluster File Store Cluster
Flash(ActionScript3)2011年5月16日月曜日
web-app server info-socket-server chat-socket-server game-socket-server
MySQLhadoop cluster File Store Cluster
Flash(ActionScript3)2011年5月16日月曜日
web-app server info-socket-server chat-socket-server game-socket-server
MySQLhadoop cluster File Store Cluster
Flash(ActionScript3)
独自実装の分散KVS
2011年5月16日月曜日
独自実装の分散KVS
Namura Distributed Index(NDI)名村が2008年頃に開発した分散KVS
2011年5月16日月曜日
独自実装の分散KVS
Namura Distributed Index(NDI)名村が2008年頃に開発した分散KVS
range search by keyauto shardingauto failoveron memory
2011年5月16日月曜日
独自実装の分散KVS
Namura Distributed Index(NDI)名村が2008年頃に開発した分散KVS
range search by keyauto shardingauto failoveron memory
最終的にサーバは200台近くまで増設管理コスト肥大化
開発•検証環境のメンテナンス大変
2011年5月16日月曜日
NDIからMySQLへのリプレイス
200台近くのノードでさばいていた参照クエリをMySQL × 4台でさばく
2011年5月16日月曜日
NDIからMySQLへのリプレイス
200台近くのノードでさばいていた参照クエリをMySQL × 4台でさばく
MySQLのディスクI/O
問題
2011年5月16日月曜日
FusionIOの導入
NANDコントローラのあるカードに、専用のメモリモジュールを装着して利用するSSD(I/O Accerarator)
ReadでHDの5倍ぐらい WriteでHDの7~8倍ぐらいのパフォーマンス
2011年5月16日月曜日
Fusion-io社の製品ページ
2011年5月16日月曜日
SAS RAID5
FusionIO
2011年5月16日月曜日
MySQL QPS CPU
Load Average Traffic
2011年5月16日月曜日
MySQL QPS CPU
Load Average Traffic
2011年5月16日月曜日
スケールアウトからスケールアップへ
2011年5月16日月曜日
スケールアウトからスケールアップへ
•スケールアウト自体はミニマムスタートには超有効•安価なサーバ•スケーラブルなソフトウェア設計
2011年5月16日月曜日
スケールアウトからスケールアップへ
•スケールアウト自体はミニマムスタートには超有効•安価なサーバ•スケーラブルなソフトウェア設計
システムの成長が早い場合には管理コストの増大に追いつくのが大変※管理コストに追われて機能追加が遅れる
2011年5月16日月曜日
AmebaPiggの今後の課題
2011年5月16日月曜日
ダウンタイムの削減
ユーザーによる不正行為の防止
とはいえ、増え続けるサーバの管理
2011年5月16日月曜日
ダウンタイムの削減
ユーザーによる不正行為の防止
とはいえ、増え続けるサーバの管理
リリース時のサービス停止の削減監視機能強化
2011年5月16日月曜日
ダウンタイムの削減
ユーザーによる不正行為の防止
とはいえ、増え続けるサーバの管理
リリース時のサービス停止の削減監視機能強化
低年齢層や女性ユーザーも引き続き安心して使えるようにゲームでの不正行為防止
2011年5月16日月曜日
ダウンタイムの削減
ユーザーによる不正行為の防止
とはいえ、増え続けるサーバの管理
リリース時のサービス停止の削減監視機能強化
低年齢層や女性ユーザーも引き続き安心して使えるようにゲームでの不正行為防止
自作サーバの組み立て外注各種設定の更なる自動化
2011年5月16日月曜日
興味のある方は是非使ってみてください
2011年5月16日月曜日
ご清聴ありがとうございました
2011年5月16日月曜日