60
-confidential- © 2009 rocketstart All Rights Reserved This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. nanapi の ののの のののののののののののの CTO ののの(id:wadap)

Cake Matsuri Nanapi

Embed Size (px)

Citation preview

Page 1: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

nanapi の レシピ株式会社ロケットスタート

CTO 和田修一 (id:wadap)

Page 2: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

「 nanapi 」というサービス

Page 3: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

ご存知ですか?

Page 4: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Page 5: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Page 6: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

生活の知恵を共有できる

Page 7: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

CGM サイト

Page 8: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

リリース日 : 2009 年 9 月1 日月間 PV :約 150 万月間 UU :約 50 万

Page 9: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

nanapi の構築事例

Page 10: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Cake の話少なめかもしれません

><

Page 11: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

本日のアジェンダ

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 12: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 13: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介名前 : 和田修一 / id:wadap所属 : 株式会社 ロケットスタートBlog : Unix 的なアレ( http://d.hatena.ne.jp/wadap/)連載 : Unix 的なアレ gihyo.jp 出張所経歴 : 2005 年、楽天株式会社に新卒入社

主にサーバ・ストレージの設計構築に携わる

2009 年 6 月に退職。ロケットスタート CTOに就任

Page 14: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

開発環境

ThinkPad x200

Windows の作業フォルダをVmware がマウント

CentOS5.3 (i386)Windows7

Page 15: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 16: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

フレームワーク選定

実は、わたくし

Page 17: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

フレームワーク選定

インフラ専門

Page 18: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

フレームワーク選定

得意な言語がないんです><

Page 19: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

フレームワーク選定

得意なフレームワークもないんです><

Page 20: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

そのためゼロベースで選択しました

フレームワーク選定

Page 21: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

選ぶときの3つの基準

習得が高速ドキュメントが豊富一人で開発しやすい

Page 22: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

一応さわったことがあるもの

Page 23: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Google Trend での傾向

Page 24: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 25: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

フレームワークやっぱり便利!

nanapi の設計ポリシー

Page 26: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

でもやっぱり

nanapi の設計ポリシー

Page 27: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

重いよねぇ

nanapi の設計ポリシー

Page 28: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

まぁ仕方ないっす

nanapi の設計ポリシー

Page 29: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

じゃぁ使いどころ考えよう!

nanapi の設計ポリシー

Page 30: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

nanapi の機能

Page 31: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

機能ごとの切り分け高速さ

処理の複雑さ

会員機能

投稿機能

検索機能

評価機能

CakePHP

文章表示

トップページ

静的コンテンツ

Ajax 用 API

PHP + Clearsilver

PHP

Page 32: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

(ちょっと脱線) Clearsilver って?

C 言語で書かれた超高速なテンプレートエンジン

データファイル

テンプレート

ファイル

HTML

Page 33: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

ドメインで分けるhttp://nanapi.jp/member/ http://r.nanapi.jp/560/

Page 34: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Apache の Alias でわけるhttp://nanapi.jp/

<VirtualHost *:80> ## top page AliasMatch “^/$” /var/www/webroot/top.php</VirtualHost>

そのほか、 Ajax 用の API も Alias で指定しています

Page 35: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 36: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

ベンチャーですもの

nanapi システム構成

Page 37: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

豪華なシステムはくめません

nanapi システム構成

Page 38: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

それでも

nanapi システム構成

Page 39: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

安く高速で

スケーラブル

nanapi システム構成

Page 40: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

そこで考えた構成

nanapi システム構成

Page 41: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

スタンドアロン型インフラ

nanapi システム構成

Page 42: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

データさえ分散できれば

nanapi システム構成

Page 43: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

スケールアウトは容易

nanapi システム構成

Page 44: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

nanapi システム構成

評価の数値、 PV の数値 Tokyo Tyrant

HTML 化済み、文章データ ファイル

ドキュメントデータ、会員情報など MySQL

キャッシュ、 Token など一時データ Memcached

Page 45: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

投稿システムのお話

Page 46: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

投稿ごとにファイルを生成

文章を投稿するとき

投稿

MySQL

転送

Server - A Server - B

ユーザーから投稿を受け付ける。独自記法を採用しているため、パース前の

データを DBへ保存。パースしたものをファイルで保存。

データファイ

Page 47: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

投稿ごとにファイルを生成

文章を投稿するとき

投稿

MySQL

転送

Server - A Server - B

Lsyncd (注)で指定したディレクトリを監視し、

リモートサーバへファイルを転送

データファイ

Page 48: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

投稿ごとにファイルを生成

文章を投稿するとき

投稿

MySQL

転送

Server - A Server - B

rsyncd daemon でファイルを受け取り、ローカル Diskへ保存

データファイ

Page 49: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

表示も高速に!

nanapi システム構成

Page 50: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

文書ページでの表示優先順位

最優先あとまわし

あとまわし

Page 51: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

文章ページの表示

パース済み HTML

Page 52: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

文章ページの表示

Ajax で数値を取得

Page 53: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

そのほかにも

CSS SPRITE静的コンテンツの外部ドメイン

Expireヘッダの付与

静的コンテンツの GZIP 化

Page 54: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

徹底的に高速化!

Page 55: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自己紹介1CakePHP を選んだワケ2nanapi の設計ポリシー3nanapi のシステム構成4さいごに5

Page 56: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

よいなぁと思う文化

Page 57: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

自分も積極的に参加をしていきたいと思っています!

さいごに

Page 58: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

nanapi もよろしくね!

さいごに

Page 59: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.

Version :1.2Controller :13Component :10View :80

みんなしゃべっていたので・・・

Page 60: Cake Matsuri Nanapi

-confidential- © 2009 rocketstart All Rights ReservedThis message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.