Ruby-on-rails – Mongrel vs. WEBrick

rubyruby-on-rails

What is the difference between Mongrel and WEBrick?

Which one should I use?

Why does Rails ship with both?

Best Solution

For your local development, they'll both work. Mongrel is faster, more efficient, and stable. Some people (myself included) use it to host their production sites, even. Certainly okay for local development.

If you're on non-Windows, I'd suggest looking at Phusion Passenger. You can support multiple apps on your localhost without having to do a 'ruby script/server' every time you want to run something.

When running Phusion Passenger, you'll have to tail the log file yourself. mongrel will display the log in the console window, so to get that functionality you'll have to tail -f log/development.log with Passenger.

Why does Rails ship with both? History. Webrick is written in ruby, so it was the early favorite. Mongrel came along and was better, but webrick support wasn't dropped.

If you don't want to install Phusion Passenger, use mongrel. It's the default and it works.

EDIT 2009-08: I've also had good luck with thin, a drop-in replacement for mongrel. For development, it's not that big of a deal, but it'd be something to check out for production.