Problem:
When developing for Ruby on Rails, the development server (the one used by script/server
) feels slow and unresponsive.
Cause:
RoR uses WEBrick as the default server. Based on my experience on a Ubuntu virtual machine with 1GB of RAM, this server doesn’t respond as fast as the web application servers in other web languages (Apache, Tomcat, IIS).
Solution:
Install Mongrel. In Ubuntu 9.04, you can install this using:
sudo gem install mongrel
In case you receive build errors, you might have to install ruby-dev
to deal with the dependency issues.
sudo apt-get install ruby-dev
Once installed, Rails will automatically use Mongrel as the application server over WEBrick.
UPDATE: Mongrel’s pretty much dead by now. Use thin
instead.
Just add gem 'thin'
to your Gemfile
and run bundle install
.