yusukebe in yokohama.pm 090909
TRANSCRIPT
![Page 1: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/1.jpg)
エロサイト管理者の憂鬱Ⅱ- How I build, operate, monetize, and tune up small web applications -
yusukebeYokohama.pm
2009/9/9
![Page 2: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/2.jpg)
yusukebe
• Yusuke Wada / 和田裕介• 1981年12月23日生• 神奈川県鎌倉市鎌倉山• 株式会社ワディット代表取締役• 株式会社オモロキCTO
• 「yusukebe the Erogeek!」
![Page 3: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/3.jpg)
yusukebe
• Yusuke Wada / 和田裕介• 1981年12月23日生• 神奈川県鎌倉市鎌倉山• 株式会社ワディット代表取締役• 株式会社オモロキCTO
• 「yusukebe the Erogeek!」
![Page 4: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/4.jpg)
“Kailas”
• Yet Another BPM Framework
• 9/10 13:45 -
• ワディットコーポレートトラック• Masanori will talk!
![Page 5: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/5.jpg)
What I’ve done.
• About 10 web applications• About 10 ero sites
![Page 6: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/6.jpg)
Total PV
600,000 pv over / 1day
![Page 7: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/7.jpg)
![Page 8: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/8.jpg)
![Page 9: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/9.jpg)
How I
BUILDOPERATEMONETIZETUNE UP
these small web applications.
![Page 10: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/10.jpg)
Why I make small web applications?
• 楽しい• セルフ・ブランディング• 勉強• お金• 全て一人でできる!
– 企画・開発・運用・マーケティング・プロモーション
![Page 11: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/11.jpg)
1. BUILD
![Page 12: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/12.jpg)
Off course
using Perl !
![Page 13: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/13.jpg)
Perl
• use Catalyst (5.7系)
• use Mouse (not Moose)
• use DBIx::Class
![Page 14: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/14.jpg)
Catalyst application ディレクトリ構成
yusuke@dev:~/work/myapp/MyApp$ tree ..|-- db| |-- myapp.sql| `-- update_schema.pl|-- cli|-- myapp_web.yml|-- lib|-- root| |-- favicon.ico| `-- static| `-- images|-- script`-- t |-- 01app.t |-- 02pod.t |-- 03podcoverage.t `-- 11_api.t
![Page 15: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/15.jpg)
Catalyst application ディレクトリ構成
yusuke@dev:~/work/myapp/MyApp$ tree lib/lib/`-- MyApp |-- API | `-- Role.pm |-- API.pm |-- CLI |-- Schema |-- Schema.pm |-- Web | |-- Controller | | `-- Root.pm | |-- Model | | `-- API.pm | `-- View | `-- TTSite.pm `-- Web.pm
![Page 16: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/16.jpg)
use Mouse in the service layerpackage Twib::API;use Mouse;with 'Twib::API::Role';
no Mouse;
sub get_popular_links { my ( $self, $args, $page, $rows ) = @_; $args ||= {}; $page ||= 1; $rows ||= 20; return $self->schema->resultset('Link') ->search( $args, { order_by => 'tweet_count DESC', page => $page, rows => $rows } );}
1;__END__
![Page 17: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/17.jpg)
./db/update_schema.pl#!/usr/bin/perl
use strict;use warnings;use FindBin;use DBIx::Class::Schema::Loader qw/make_schema_at/;
my $schema_class = "Twib::Schema";my $connect_info = [ 'dbi:mysql:twib:localhost', 'root', '' ];
make_schema_at( $schema_class, { components => [qw/UTF8Columns InflateColumn::DateTime/], dump_directory => File::Spec->catfile( $FindBin::Bin, '..', 'lib' ), debug => 1, }, $connect_info,);__END__
![Page 18: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/18.jpg)
たくさん作って自分なりのスタイルを作ること
素早い開発が可能に!
![Page 19: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/19.jpg)
フロントエンドはライブラリを有効活用しよう!
![Page 20: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/20.jpg)
JavaScript
• jQuery
• jQuery UI
• Shadowbox
![Page 21: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/21.jpg)
CSS
• jQuery UI
• YUI
![Page 22: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/22.jpg)
できないHTMLデザインは他の人の力で解決しよう
![Page 23: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/23.jpg)
![Page 24: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/24.jpg)
![Page 25: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/25.jpg)
HTML Themes
• WooThemes– http://www.woothemes.com/
• Open Source Web Design– http://www.oswd.org
![Page 26: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/26.jpg)
2. OPERATE
![Page 27: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/27.jpg)
Hardware
• ec2: 5 instances ( 6 cores )
• 自宅: 1 front / 1 fs / 1 db / 2 app servers
Software• debian etch
• apache2.2 + mod_perl
• MySQL
• gearman, Q4M
![Page 28: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/28.jpg)
自宅サーバールーム(納戸)
Front
Router
2 UPS
iSCSI
FS
App / Q6600
DBBokete App
App / sc1435
![Page 29: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/29.jpg)
ec2自宅
FrontApache 2.2
Amazon S3
FSNFS
AppApache 2.2 with mod_perl
DBMySQL 5
![Page 30: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/30.jpg)
from httpd.conf on Front
<VirtualHost *:80> ServerName twib.jp DocumentRoot /home/yusuke/www/pulpsite/Twib/root AllowEncodedSlashes On RewriteEngine On RewriteRule ^/(static/|favicon.ico) - [L] RewriteRule ^/(.*)$ http://192.168.1.22:8102/$1 [P,L] ExpiresActive On <FilesMatch "\.(jpg|gif|png|ico|css|js)$"> ExpiresDefault "access plus 365 days" </FilesMatch></VirtualHost>
![Page 31: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/31.jpg)
from httpd.conf on AppKeepAlive OffLoadModule perl_module /usr/lib/apache2/modules/mod_perl.soLoadModule rpaf_module /usr/lib/apache2/modules/mod_rpaf-2.0.soRPAFenable OnRPAFsethostname OffRPAFproxy_ips 192.168.1.11 127.0.0.1
Listen 8102PidFile /var/run/apache2/twib.pid
StartServers 1MinSpareServers 4MaxSpareServers 12MaxClients 24MaxRequestsPerChild 10000
PerlSwitches -I/home/yusuke/www/pulpsite/Twib/libSetHandler perl-scriptPerlHandler Twib::Web
![Page 32: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/32.jpg)
Using S3 as Front-end Server
![Page 33: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/33.jpg)
3. MONITIZE
![Page 34: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/34.jpg)
収入源は基本的にアフィリエイト
– DTI, sbs, DMM, Amazon, Rakuten, etc.– AdSense
• 気楽でいい• 成果報酬• 継続報酬
![Page 35: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/35.jpg)
単純だけど基本原理
運用コスト収入=
アクセス
![Page 36: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/36.jpg)
運用コストを下げれば儲かる=
サーバーの台数を減すんだ=
1台でまかなえる処理数を増やす=
ソフトウェアチューニング!
![Page 37: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/37.jpg)
4. TUNE UP
![Page 38: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/38.jpg)
Basic tuning
• ゆーすけべー日記「YourAVHost その後」– YourAVHostのページ内に含まれる画像を全て mod_perl の apache でサーブしていた– そこで画像を全て static なコンテンツを扱う apache2 でサーブさせようとしたが、キャッ
シュの設定、具体的には mod_expire の設定を何もしていなかった
– mod_perl で処理する必要の無い静的コンテンツは mod_perl で扱うな– 静的コンテンツには mod_expire で Expires ヘッダーをつけてキャッシング
させよ
![Page 39: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/39.jpg)
Web App
use Worker; # on Twib
Q4MStream Reader
DB
Fecher
use AnyEvent::Twitter::Stream;
![Page 40: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/40.jpg)
use HTTP::Engine;yusuke@dev:~/work/XXX/trunk$ tree lib/lib/|-- XXX| |-- API.pm| |-- C| | |-- Root.pm| | `-- Video.pm| |-- ModPerl.pm| |-- Router.pm| |-- Schema| | |-- CaptchaImage.pm| | |-- Download.pm| | `-- Video.pm| `-- Schema.pm|-- SimpleApp| |-- Controller.pm| |-- ModPerl.pm| |-- Server.pm| `-- View.pm`-- WWW `-- YourFileHost `-- Break.pm
![Page 41: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/41.jpg)
それPla
Plack HACKS
それPlackでやりなよ
![Page 42: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/42.jpg)
“Noe” based on Plack
![Page 43: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/43.jpg)
Other tips
• use Cache::FileCache; # on ec2
• 意図的なdbの非正規化• mod_perl の Cow なメモリ共有を増やす
![Page 44: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/44.jpg)
More…
![Page 45: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/45.jpg)
そこで(内緒だよ♡)
![Page 46: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/46.jpg)
おかげで
![Page 47: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/47.jpg)
ルータ交換しました^ ^ ;
![Page 48: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/48.jpg)
今後
• 継続するサービスを– コンテンツ– 運用
• 更なる省力化– Front-end レイヤーでの File Cache
![Page 49: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/49.jpg)
Wrap up
• Building a small web application is fun.
• アプリケーションの最適化は奥が深い• けれども個人で様々な工夫ができる!
– 開発– 運用– マネタイズ– チューニング
![Page 50: yusukebe in Yokohama.pm 090909](https://reader031.vdocuments.pub/reader031/viewer/2022030218/588656ea1a28ab26598b5235/html5/thumbnails/50.jpg)
Make your own web applications !
END