Xen and the Art of Rails Deployment

Ezra Zygmutowicz from EngineYard

http://brainspl.at/

 

Ragel <- Mongrel HTTP Parse

 

Rails isn't Thread Safe

1 req at a time

scale with cluster  -> Mutex

 

seeking old trick for clustering

 

Haproxy 추천 conn rate limits, very high perf

 

Aapache 2.2.x <- fetch cost > mongrel

 

Nginx

performance, small foot front, without leaking memory, killer rewrite, proxy

 

Nginx + Mongrel  <- 강력 추천

아파치는 mod_dav_svn 용으로만

fast, fast, fast

 

No mongrel_upload_progress

No conn rate limit

 

http_script_module NeckVM  faster than lua

 

 

Perfect Stack

Lunux/Nginx/Mongrel/Monit

 


Swiftiply

http://swiftiply.swiftcore.org/

Teaching the Dog new tricks

 

Evented Mongrel

Hot patch to Mongrel

Removes Ruby hread, Socket from mongrel -> Event Driven SingleThreaded

Speed/IO 스루풋 up

잘 버튼다.

 

single threadead event driven mongrel

Ruby green thread overhead

mutex expensive

no context switching between threads IO 스루풋
정말 빠르더라는 벤치마크 결과

 

Proxy로도 좋다

Event Driven Proxy

faster Haproxy

 

80

swittiplied proxy

8000
mongrels same port

방향이 다르다. 설정이 쉬워진다. Event-Driven Queue

auto configured in thr proxy

scaling the number of mongrels automatically in reponse to increased load on the fly!

static file은 nginx에서

 

 

 

 

 

Zen of Xen

 

Monolithic Linux v. Modularized Linux

targeted virtualized linux with each VM running a single tier or service

한 서버에 전부 담는 것

vs
little targeted machine

seperate of concern!

 

old

can scale but less flexible

 

new

migrate live!!

 

SAN storage for all Xen domU(VPS's)

RedHat Clustering Suite

GFS for 100% posix compliant clustered filesystem

deploy도 한 곳에만, page caching도 쉬워지고


Most Rails App RAM bound

average 70-120Mb

RMagic, :include -> worse culprits

95% of Rails app will leak memory

 

index는 기본

SQL를 어쩌피 봐야지

 

filesystem session AR, SQLSession (x)

script/runner 비효률적   Rails를 다 올리는건 바람직하지 않다. Mysql을 직접?

incomming email -> fork runner (x)

 

Rails is great for 80/20 rule

last 20이 필요할땐 혼자

custom mongrel handlers <- 결국 필요할지도

ruby is plenty fast, 느린건 rails

cache, cache, cache

 

Rails의 장점도 많다. 나머지는 알아서 하고 기여하자. 20%를 해결하고 공유하는게 어떨까?

 

AR 객체를 Memcache

 

Event Driven Logger도 좋다