History Lesson
Apache + CGI
➲
Apache + FastCGI
➲
Lighttpd + FastCGI
➲
Lighttpd + SCGI
➲
Litespeed
➲
etc. etc. (mod_fcgi, mod_ruby)
➲
Mongrel
➲
Enter Mongrel
Mongrel て何 ?
Mongrel は犬の雑種
image by Ezra Zygmuntowicz
Mongrel て何 ? (2)
Mongrel は犬の雑種
flickr image
Mongrel て何 ? (3)
HTTP サーバ and library by Zed Shaw
➲
Almost pure Ruby (HTTP parser in C)
➲
Modular = can have my own handlers
➲
Library = can have my own framework
➲
Merb: http://merb.rubyforge.org/
●
Ramaze: http://ramaze.rubyforge.org/
●
動的リクエスト
Mongrel != Rails
➲
Mongrel IS thread safe
➲
Rails IS NOT thread save (CGI.rb)
➲
Giant Mutex Lock around the Dispatcher
➲
Mongrel は時間単位で 1 リクエストを提供
➲
Mutex Lock around the Dispatcher
image by Ezra Zygmuntowicz
どうしよう?
プロセスとともに拡張
mongrel_cluster
➲
ロードバランサ
➲
ロードバランサ
pen (no SSL)
➲
pound (restart to reload the config)
➲
balance
➲
HAproxy
➲
LiteSpeed ロードバランサ ($1299)
➲
Config: OS tuning
user www-data;
worker_processes 1;
events {
worker_connections 1024;
use epoll;
}
Config: HTTP block
http {
include conf/mime.types;
include conf/optimize.conf;
upstream mybackends {
server b1.example.com weight=5;
server b2.example.com:8080;
server unix:/tmp/backend3;
}
server {
...
}
Config: server block
server {
listen 80;
name s1.example.com;
location / {
}
}
server {
listen 80;
name s2.example.com;
...
}
0 comments
Post a comment