What is the difference between Rack and Rails Metal (Ruby)?

I do not understand!

Reception: http://rack.rubyforge.org/

Rails Metal: http://weblog.rubyonrails.org/2008/12/17/introducing-rails-metal

I read two articles and my eyes blurred. How are these two components related? Would examples be great?

+6
ruby rack
source share
3 answers

Rack is a very lightweight specification that Ruby web servers can implement. This is middleware, which means that it is between a web server (such as a passenger) and Rails.

Rails Metal is a way to handle an HTTP request using Rails when you need maximum performance. It actually takes you to the metal and bypasses all the usual functions (and therefore the overhead) that the standard Rails request / response cycle gives you. Technically, Rails Metal is an implementation of a rack handler.

You can find these two Railscasts on topic informative:

You can get the middleware stack list for a Rails application with rake middleware

+12
source share

Rack is a common Ruby API / abstraction layer that allows various application infrastructures to integrate into a web server.

Rails Metal is a Rails implementation of a rack handler. It includes not only a handler that calls Rails, but also provides its own API, which makes it easy to create your own handlers that go to the web server and bypass main Rails.

+4
source share

There's a lot of discussion and some examples on Jesse Newland's site :

So, essentially, Rails Metal is a thin wrap around the Rails new rack middleware support . An intermediate-level tool is quite powerful material: structure-independent components that process requests on their own or in concert with other middleware.

+4
source share

All Articles