SlideShare a Scribd company logo
Rails Deployment with NginX



                完全な rails スタックの探求
自己紹介


    名前: Stoyan Zhekov
➲
    ブルガリア人
➲
    子供は男三人
➲
    web: http://zhekov.net/
➲
Deploying Rails

    Deployment て何?
➲
    Too many changes last years
➲
    お金の話
➲
        EngineYard: $299/mo per slice
    ●
        RailsMachine: $245/mo + $60 setup
    ●
奇本が変わらない


    フロントエンドの web サーバ
➲
        静的リクエストの処理
    ●
    バックエンドのアプリケーションサーバ
➲
        動的リクエストの処理
    ●
    デタベース
➲
奇本が変わらない (2)




image by Ezra Zygmuntowicz
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/
    ●
Why Mongrel (and HTTP)?


    HTTP は良く知られているプロトコル
➲
    Mongrel はセットアップが容易
➲
    高速
➲
    管理が容易 (monit)
➲
    Scale が容易 (TCP/IP)
➲
動的リクエスト


    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)
➲
一般的な問題は?


    静的ファイルを提供しない
➲
    ロードがバックエンドにシフトする (bad)
➲
静的リクエスト


    JavaScript – bigger and bigger (AJAX)
➲
    Multimedia – video, images
➲
    Rails caching - .html
➲
    Distributed assets - assets%i.dot.com
➲
フロントエンドの web サーバ


    Apache – VPS の RAM は不十分
➲
    Lighttpd – 高負荷ではメモリリーク
➲
    Litespeed – 同時リクエスト数上限は 300
➲
NginX: from Russia with love


    名前: nginx [engine x]
➲
    HTTP サーバ and IMAP/POP3/SMTP proxy
➲
    ロシアの 20% は NginX でできてる
➲
    fastmail.fm
➲
    EngineYard
➲
問題


    単独プロジェクト
➲
    ロシア語を読み書きできるか
➲
    CGI サポートなし
➲
なぜ NginX?

    パフォーマンスがいい
➲
    稼働時のメモリ使用量が小さい (VPS)
➲
    proxy でメモリリークは無い
➲
    名前ベース、 IP ベースのバーチャルサーバ
➲

    PUT, DELETE, MKCOL, COPY and MOVE
➲
    Modular
➲
    FLV streaming もできる
➲
パフォーマンスがいい


    Serious Web servers use event loops
➲
        http://www.kegel.com/c10k.html
    ●

    各 OS に最適化されてる (async)
➲
        BSD – kqueue
    ●
        Linux 2.6 – epool
    ●
        Solaris 10 – EventPorts (Joyent.com)
    ●
High availability

    unix による管理
➲
        kill -HUP – reload the config
    ●
        kill -USR2 – BINARY RELOAD
    ●
Coding style
if (m[1] == 'O') {
  if (m[0] == 'P' && m[2] == 'S' && m[3] ==
 'T') {
    r->method = NGX_HTTP_POST;
    break;
  }
  if (m[0] == 'C' && m[2] == 'P' && m[3] ==
 'Y') {
    r->method = NGX_HTTP_COPY;
    break;
  }
...
NginX のインストール



Two versions: 0.5.x (stable) and 0.6.x
 (devel)

(Debian/Ubuntu)
# apt-get install libssl-dev

http://zhware.net/code/shell/mk_nginx.sh.txt
NginX Configuration

Ezra Zygmuntowicz (merb, BackgroundDRb):

http://brainspl.at/nginx.conf.txt
http://pastie.caboo.se/84928

# gem install nginx_config_generator
# generate_nginx_config –example > config.yml
# generate_nginx_config config.yml nginx.conf
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;
  ...
}
Config: location blog



location / {
  ...
  proxy_pass   http://mybackends;
  ...
}
おもろいもの

    Virtual SSI
➲
        <!--# include virtual=”/foo” -->
    ●

    Mirror on demand
➲
    memcached module
➲
NginX Rails config
location / {
  # static files
  if (-f $request_filename) {
    break;
  }
  # rails caching
  if (-f $request_filename.html) {
    rewrite (.*) $1.html break;
  }
  if (!-f $request_filename) {
    proxy_pass http://mongrel;
    break;
  }
}
Links

    英語 : http://nginx.net/
➲
    wiki: http://wiki.codemongers.com/
➲
    my notes: http://wiki.zhekov.net/nginx
➲
    links: http://del.icio.us/zh/nginx
➲
    chat: #nginx on FreeNode,
➲
    http://www.lingr.com/room/nginx/
これから

    組合せ
➲
        nginx + Litespeed backends
    ●
    バックエンドの最適化
➲
        Swiftiply Proxy: http://swiftiply.swiftcore.org/
    ●
        Evented Mongrel (eventmachine)
    ●

    Edge Side Includes (ESI):http://www.esi.org/
➲
    Rails の替わりに Merb を使います
➲
質問

More Related Content

What's hot

Let s Enjoy Node.js
Let s Enjoy Node.jsLet s Enjoy Node.js
Let s Enjoy Node.js
Fred Chien
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)
Данил Иванов
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
Wataru OKAMOTO
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL server
Marian Marinov
 
A3 sec -_msr_2.0
A3 sec -_msr_2.0A3 sec -_msr_2.0
A3 sec -_msr_2.0a3sec
 
Genkidama:実装と課題
Genkidama:実装と課題Genkidama:実装と課題
Genkidama:実装と課題Takuya ASADA
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webgl
Kilian Valkhof
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
Yuya Takei
 
Django and Nginx reverse proxy cache
Django and Nginx reverse proxy cacheDjango and Nginx reverse proxy cache
Django and Nginx reverse proxy cache
Anton Pirker
 
Basics of html5, data_storage, css3
Basics of html5, data_storage, css3Basics of html5, data_storage, css3
Basics of html5, data_storage, css3
Sreejith Nair
 
Revisited
RevisitedRevisited
Revisited
Shunsaku Kudo
 
Nginx常见应用技术指南(Nginx Tips)
Nginx常见应用技术指南(Nginx Tips)Nginx常见应用技术指南(Nginx Tips)
Nginx常见应用技术指南(Nginx Tips)
dreamwing.org
 
PyGotham 2014 Introduction to Profiling
PyGotham 2014 Introduction to ProfilingPyGotham 2014 Introduction to Profiling
PyGotham 2014 Introduction to Profiling
Perrin Harkins
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
OWASP Russia
 
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack
 
5 things MySql
5 things MySql5 things MySql
5 things MySql
sarahnovotny
 
Wrapper to use Japanse font with vcd::mosaic and build it as pakcage
Wrapper to use Japanse font with vcd::mosaic and build it as pakcageWrapper to use Japanse font with vcd::mosaic and build it as pakcage
Wrapper to use Japanse font with vcd::mosaic and build it as pakcage
Tsuda University Institute for Mathematics and Computer Science
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionWebtrends
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Tatsuhiko Miyagawa
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badooMarko Kevac
 

What's hot (20)

Let s Enjoy Node.js
Let s Enjoy Node.jsLet s Enjoy Node.js
Let s Enjoy Node.js
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL server
 
A3 sec -_msr_2.0
A3 sec -_msr_2.0A3 sec -_msr_2.0
A3 sec -_msr_2.0
 
Genkidama:実装と課題
Genkidama:実装と課題Genkidama:実装と課題
Genkidama:実装と課題
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webgl
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
 
Django and Nginx reverse proxy cache
Django and Nginx reverse proxy cacheDjango and Nginx reverse proxy cache
Django and Nginx reverse proxy cache
 
Basics of html5, data_storage, css3
Basics of html5, data_storage, css3Basics of html5, data_storage, css3
Basics of html5, data_storage, css3
 
Revisited
RevisitedRevisited
Revisited
 
Nginx常见应用技术指南(Nginx Tips)
Nginx常见应用技术指南(Nginx Tips)Nginx常见应用技术指南(Nginx Tips)
Nginx常见应用技术指南(Nginx Tips)
 
PyGotham 2014 Introduction to Profiling
PyGotham 2014 Introduction to ProfilingPyGotham 2014 Introduction to Profiling
PyGotham 2014 Introduction to Profiling
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
 
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
 
5 things MySql
5 things MySql5 things MySql
5 things MySql
 
Wrapper to use Japanse font with vcd::mosaic and build it as pakcage
Wrapper to use Japanse font with vcd::mosaic and build it as pakcageWrapper to use Japanse font with vcd::mosaic and build it as pakcage
Wrapper to use Japanse font with vcd::mosaic and build it as pakcage
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data Collection
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badoo
 

Viewers also liked

Microblogging via XMPP
Microblogging via XMPPMicroblogging via XMPP
Microblogging via XMPPStoyan Zhekov
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5
Stoyan Zhekov
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
Stoyan Zhekov
 
Ruby cooking
Ruby cookingRuby cooking
Ruby cooking
Stoyan Zhekov
 
Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)
Stoyan Zhekov
 
Alliance Day 2007: Philadelphia Cultural List Cooperative
Alliance Day 2007: Philadelphia Cultural List CooperativeAlliance Day 2007: Philadelphia Cultural List Cooperative
Alliance Day 2007: Philadelphia Cultural List Cooperative
catet
 

Viewers also liked (6)

Microblogging via XMPP
Microblogging via XMPPMicroblogging via XMPP
Microblogging via XMPP
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Ruby cooking
Ruby cookingRuby cooking
Ruby cooking
 
Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)
 
Alliance Day 2007: Philadelphia Cultural List Cooperative
Alliance Day 2007: Philadelphia Cultural List CooperativeAlliance Day 2007: Philadelphia Cultural List Cooperative
Alliance Day 2007: Philadelphia Cultural List Cooperative
 

Similar to Rails Deployment with NginX

yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909Yusuke Wada
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
National Cheng Kung University
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)
Stoyan Zhekov
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
nam kwangjin
 
Hp Linux
Hp LinuxHp Linux
Hp Linuxtelab
 
Working With Rails
Working With RailsWorking With Rails
Working With Rails
Dali Wang
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPAtsuhiro Kubo
 
High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)
Stoyan Stefanov
 
MySQL Clusterで高性能システムを構築する際のポイント
MySQL Clusterで高性能システムを構築する際のポイントMySQL Clusterで高性能システムを構築する際のポイント
MySQL Clusterで高性能システムを構築する際のポイント
K H
 
Spring基础教程
Spring基础教程Spring基础教程
Spring基础教程
Shilong Sang
 
spring_jiaocheng
spring_jiaochengspring_jiaocheng
spring_jiaocheng
Shilong Sang
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Mark Stanton
 
Transfer to kubernetes data platform from EMR
Transfer to kubernetes data platform from EMRTransfer to kubernetes data platform from EMR
Transfer to kubernetes data platform from EMR
창언 정
 
HA+DRBD+Postgres - PostgresWest '08
HA+DRBD+Postgres - PostgresWest '08HA+DRBD+Postgres - PostgresWest '08
HA+DRBD+Postgres - PostgresWest '08
Jesse Young
 
20090323 Phpstudy
20090323 Phpstudy20090323 Phpstudy
20090323 PhpstudyYusuke Ando
 
Web技術勉強会 第19回
Web技術勉強会 第19回Web技術勉強会 第19回
Web技術勉強会 第19回
龍一 田中
 
Seize The Cloud
Seize The CloudSeize The Cloud
Seize The Cloud
Keiichi Daiba
 

Similar to Rails Deployment with NginX (20)

yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
SEASR Installation
SEASR InstallationSEASR Installation
SEASR Installation
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Hp Linux
Hp LinuxHp Linux
Hp Linux
 
Working With Rails
Working With RailsWorking With Rails
Working With Rails
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
 
Grails紹介
Grails紹介Grails紹介
Grails紹介
 
High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)
 
MySQL Clusterで高性能システムを構築する際のポイント
MySQL Clusterで高性能システムを構築する際のポイントMySQL Clusterで高性能システムを構築する際のポイント
MySQL Clusterで高性能システムを構築する際のポイント
 
Spring基础教程
Spring基础教程Spring基础教程
Spring基础教程
 
spring_jiaocheng
spring_jiaochengspring_jiaocheng
spring_jiaocheng
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
 
Transfer to kubernetes data platform from EMR
Transfer to kubernetes data platform from EMRTransfer to kubernetes data platform from EMR
Transfer to kubernetes data platform from EMR
 
HA+DRBD+Postgres - PostgresWest '08
HA+DRBD+Postgres - PostgresWest '08HA+DRBD+Postgres - PostgresWest '08
HA+DRBD+Postgres - PostgresWest '08
 
20090323 Phpstudy
20090323 Phpstudy20090323 Phpstudy
20090323 Phpstudy
 
Web技術勉強会 第19回
Web技術勉強会 第19回Web技術勉強会 第19回
Web技術勉強会 第19回
 
Seize The Cloud
Seize The CloudSeize The Cloud
Seize The Cloud
 

More from Stoyan Zhekov

Multirotors
MultirotorsMultirotors
Multirotors
Stoyan Zhekov
 
ZeroMQ
ZeroMQZeroMQ
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
Stoyan Zhekov
 
Sequel
SequelSequel
Deployment on Heroku
Deployment on HerokuDeployment on Heroku
Deployment on HerokuStoyan Zhekov
 
Foreman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple componentsForeman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple components
Stoyan Zhekov
 
Social Network for spare parts
Social Network for spare partsSocial Network for spare parts
Social Network for spare parts
Stoyan Zhekov
 
Using XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking informationUsing XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking information
Stoyan Zhekov
 
Websockets with ruby
Websockets with rubyWebsockets with ruby
Websockets with rubyStoyan Zhekov
 
EventMachine
EventMachineEventMachine
EventMachine
Stoyan Zhekov
 
Webhooks - glue for the web
Webhooks - glue for the webWebhooks - glue for the web
Webhooks - glue for the web
Stoyan Zhekov
 
Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Stoyan Zhekov
 

More from Stoyan Zhekov (12)

Multirotors
MultirotorsMultirotors
Multirotors
 
ZeroMQ
ZeroMQZeroMQ
ZeroMQ
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
Sequel
SequelSequel
Sequel
 
Deployment on Heroku
Deployment on HerokuDeployment on Heroku
Deployment on Heroku
 
Foreman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple componentsForeman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple components
 
Social Network for spare parts
Social Network for spare partsSocial Network for spare parts
Social Network for spare parts
 
Using XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking informationUsing XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking information
 
Websockets with ruby
Websockets with rubyWebsockets with ruby
Websockets with ruby
 
EventMachine
EventMachineEventMachine
EventMachine
 
Webhooks - glue for the web
Webhooks - glue for the webWebhooks - glue for the web
Webhooks - glue for the web
 
Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)
 

Recently uploaded

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

Rails Deployment with NginX

  • 1. Rails Deployment with NginX 完全な rails スタックの探求
  • 2. 自己紹介 名前: Stoyan Zhekov ➲ ブルガリア人 ➲ 子供は男三人 ➲ web: http://zhekov.net/ ➲
  • 3. Deploying Rails Deployment て何? ➲ Too many changes last years ➲ お金の話 ➲ EngineYard: $299/mo per slice ● RailsMachine: $245/mo + $60 setup ●
  • 4. 奇本が変わらない フロントエンドの web サーバ ➲ 静的リクエストの処理 ● バックエンドのアプリケーションサーバ ➲ 動的リクエストの処理 ● デタベース ➲
  • 6. History Lesson Apache + CGI ➲ Apache + FastCGI ➲ Lighttpd + FastCGI ➲ Lighttpd + SCGI ➲ Litespeed ➲ etc. etc. (mod_fcgi, mod_ruby) ➲ Mongrel ➲
  • 8. Mongrel て何 ? Mongrel は犬の雑種 image by Ezra Zygmuntowicz
  • 9. Mongrel て何 ? (2) Mongrel は犬の雑種 flickr image
  • 10. 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/ ●
  • 11. Why Mongrel (and HTTP)? HTTP は良く知られているプロトコル ➲ Mongrel はセットアップが容易 ➲ 高速 ➲ 管理が容易 (monit) ➲ Scale が容易 (TCP/IP) ➲
  • 12. 動的リクエスト Mongrel != Rails ➲ Mongrel IS thread safe ➲ Rails IS NOT thread save (CGI.rb) ➲ Giant Mutex Lock around the Dispatcher ➲ Mongrel は時間単位で 1 リクエストを提供 ➲
  • 13. Mutex Lock around the Dispatcher image by Ezra Zygmuntowicz
  • 15. プロセスとともに拡張 mongrel_cluster ➲ ロードバランサ ➲
  • 16. ロードバランサ pen (no SSL) ➲ pound (restart to reload the config) ➲ balance ➲ HAproxy ➲ LiteSpeed ロードバランサ ($1299) ➲
  • 17. 一般的な問題は? 静的ファイルを提供しない ➲ ロードがバックエンドにシフトする (bad) ➲
  • 18. 静的リクエスト JavaScript – bigger and bigger (AJAX) ➲ Multimedia – video, images ➲ Rails caching - .html ➲ Distributed assets - assets%i.dot.com ➲
  • 19. フロントエンドの web サーバ Apache – VPS の RAM は不十分 ➲ Lighttpd – 高負荷ではメモリリーク ➲ Litespeed – 同時リクエスト数上限は 300 ➲
  • 20. NginX: from Russia with love 名前: nginx [engine x] ➲ HTTP サーバ and IMAP/POP3/SMTP proxy ➲ ロシアの 20% は NginX でできてる ➲ fastmail.fm ➲ EngineYard ➲
  • 21. 問題 単独プロジェクト ➲ ロシア語を読み書きできるか ➲ CGI サポートなし ➲
  • 22. なぜ NginX? パフォーマンスがいい ➲ 稼働時のメモリ使用量が小さい (VPS) ➲ proxy でメモリリークは無い ➲ 名前ベース、 IP ベースのバーチャルサーバ ➲ PUT, DELETE, MKCOL, COPY and MOVE ➲ Modular ➲ FLV streaming もできる ➲
  • 23. パフォーマンスがいい Serious Web servers use event loops ➲ http://www.kegel.com/c10k.html ● 各 OS に最適化されてる (async) ➲ BSD – kqueue ● Linux 2.6 – epool ● Solaris 10 – EventPorts (Joyent.com) ●
  • 24. High availability unix による管理 ➲ kill -HUP – reload the config ● kill -USR2 – BINARY RELOAD ●
  • 25. Coding style if (m[1] == 'O') { if (m[0] == 'P' && m[2] == 'S' && m[3] == 'T') { r->method = NGX_HTTP_POST; break; } if (m[0] == 'C' && m[2] == 'P' && m[3] == 'Y') { r->method = NGX_HTTP_COPY; break; } ...
  • 26. NginX のインストール Two versions: 0.5.x (stable) and 0.6.x (devel) (Debian/Ubuntu) # apt-get install libssl-dev http://zhware.net/code/shell/mk_nginx.sh.txt
  • 27. NginX Configuration Ezra Zygmuntowicz (merb, BackgroundDRb): http://brainspl.at/nginx.conf.txt http://pastie.caboo.se/84928 # gem install nginx_config_generator # generate_nginx_config –example > config.yml # generate_nginx_config config.yml nginx.conf
  • 28. Config: OS tuning user www-data; worker_processes 1; events { worker_connections 1024; use epoll; }
  • 29. 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 { ... }
  • 30. Config: server block server { listen 80; name s1.example.com; location / { } } server { listen 80; name s2.example.com; ... }
  • 31. Config: location blog location / { ... proxy_pass http://mybackends; ... }
  • 32. おもろいもの Virtual SSI ➲ <!--# include virtual=”/foo” --> ● Mirror on demand ➲ memcached module ➲
  • 33. NginX Rails config location / { # static files if (-f $request_filename) { break; } # rails caching if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://mongrel; break; } }
  • 34. Links 英語 : http://nginx.net/ ➲ wiki: http://wiki.codemongers.com/ ➲ my notes: http://wiki.zhekov.net/nginx ➲ links: http://del.icio.us/zh/nginx ➲ chat: #nginx on FreeNode, ➲ http://www.lingr.com/room/nginx/
  • 35. これから 組合せ ➲ nginx + Litespeed backends ● バックエンドの最適化 ➲ Swiftiply Proxy: http://swiftiply.swiftcore.org/ ● Evented Mongrel (eventmachine) ● Edge Side Includes (ESI):http://www.esi.org/ ➲ Rails の替わりに Merb を使います ➲