Scott Barron wrote a great article called Session Container Performance in Ruby on Rails
This article describes the performance issues using different types of session management including:
If you want to setup Ruby on Rails to use distributed ruby , first go to the command line and type:
locate drb_server.rb
Then, using the full path to drb_server.rb, type
ruby /path/to/drb_server.rb &
This sets up the distributed ruby server to run in the background. This must be running for DRb to work.
Next, change your dispatcher. If you are using mod_ruby or cgi, change the line:
Dispatcher.dispatchDispatcher.dispatch CGI.new, {'database_manager' => CGI::Session::DRbStore}
For dispatch.fcgi, change it to,
FCGI.each_cgi { |cgi| Dispatcher.dispatch(cgi, {'database_manager' => CGI::Session::DRbStore},
File.dirname(__FILE__) + "/500.html") }
Remember to restart your apache webserver for this to take effect.
That’s it! You are done. Your sessions will now be taken care of with DRb. Not only does this scale better than the default PStore, and is usually faster, but you can now use multiple web servers in a round-robin fashion all using the same distributed session handeling so that Ruby on Rails scales horizontally.
category:Howto