Request-Response Cycle of Ruby on Rails App

2,506 views
2,109 views

Published on

This presentation describes the Request-Response cycle that a Ruby on Rails app goes through, narrowing in from a high level to a low level, and back.

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
  • Very nice explanation . But have one little doubt. After web server handover reqest to app server why 'RVM' and 'Gemfile' check is needed. I didn't find related thing in any of the rails documents. (As of my knowledge Gemfile/Gemfile.lock is used to refer gems needed to install for application) but here in this case application is already runnig. Why every request goes and checks rvm and Gemfile?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,506
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
17
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Request-Response Cycle of Ruby on Rails App

  1. 1. Request-­‐Response Ruby  on  Rails   Nathalie  Steinmetz   http://github.com/natsteinmetz   http://linkedin.com/in/nathaliesteinmetz    
  2. 2. User  Browser   DNS  Server   (1)  DNS  Lookup  (http://codefellows.org)   (2)  IP  Address   Web  Server  (for  example  Apache)   (3)  HTTP  Request              [URI]  (http://codefellows.org)              [method]  (GET)                          [request  header]  (user  agent,  etc.)   Application  Server     (for  example  Phusion  Passenger)   (4)  Recognized  Ruby                application  request  –                  forward  to  app  server   H I G H   L E V E L  
  3. 3. Ruby  Version  Manager   Gemfile   Rails  Routes   (5)  Go  to  RVM   (6)  Check  Rails  version                  in  Gemfile   (7)  Check  routes  using  HTTP                request  URI  and  method   M I   D     L E V E L  
  4. 4. L O W     L E V E L   Controller   Model   View   (9)  Go  to  Model,                  get  data  from                database   (8)  Go  to  appropriate  controller  (index)   Controller   (10)  Return  to                      controller     (11)  Compile  response  body  (HTML)  
  5. 5. Application  Server     (for  example  Phusion  Passenger)   H I G H   L E V E L   Web  Server  (for  example  Apache)   User  Browser   (14)  Render  view   (12)  Send  HTTP  Response  to  app  server                    [Status  code]  (200)                    [Response  header]  (cookie,  etc.)                    [Response  body]  (HTML,  CSS,  Javascript)   (13)  Forward  HTTP  Response   Repeat  for  linked  files   (CSS,  images,  etc.)  

×