Cake Matsuri Nanapi

Preview:

Citation preview

-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)

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

「 nanapi 」というサービス

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

ご存知ですか?

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

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

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

生活の知恵を共有できる

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

CGM サイト

-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 万

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

nanapi の構築事例

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

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

><

-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

-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

-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に就任

-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

-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

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

フレームワーク選定

実は、わたくし

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

フレームワーク選定

インフラ専門

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

フレームワーク選定

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

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

フレームワーク選定

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

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

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

フレームワーク選定

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

選ぶときの3つの基準

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

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

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

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

Google Trend での傾向

-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

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

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

nanapi の設計ポリシー

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

でもやっぱり

nanapi の設計ポリシー

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

重いよねぇ

nanapi の設計ポリシー

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

まぁ仕方ないっす

nanapi の設計ポリシー

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

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

nanapi の設計ポリシー

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

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

-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

-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/

-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 で指定しています

-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

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

ベンチャーですもの

nanapi システム構成

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

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

nanapi システム構成

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

それでも

nanapi システム構成

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

安く高速で

スケーラブル

nanapi システム構成

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

そこで考えた構成

nanapi システム構成

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

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

nanapi システム構成

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

データさえ分散できれば

nanapi システム構成

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

スケールアウトは容易

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

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

投稿システムのお話

-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へ保存。パースしたものをファイルで保存。

データファイ

-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 (注)で指定したディレクトリを監視し、

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

データファイ

-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へ保存

データファイ

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

表示も高速に!

nanapi システム構成

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

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

最優先あとまわし

あとまわし

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

文章ページの表示

パース済み HTML

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

文章ページの表示

Ajax で数値を取得

-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 化

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

徹底的に高速化!

-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

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

よいなぁと思う文化

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

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

さいごに

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

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

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

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