Mongrel vs Thin

From WikiVS
Jump to: navigation, search


Thin is generally accepted to be faster than Mongrel. "Hello World" Test Results indicate that Thin is even faster than Evented Mongrel. Thin also uses less memory.

Beginning with version 0.6.1, Thin can do UNIX socket connections to the proxying web-server, achieving faster speeds than that which were capable through TCP connections employed in Mongrel and previous versions of Thin. TCP connections are still available on Thin, of course.

Thin claims to be "the most secure, stable, fast and extensible Ruby web server." [1]

"Thin gets the extra-speed by being 100% single-threaded." [2] However, Thin supports the ability to defer longer-running requests to their own threads, thereby bypassing the problem of slow requests blocking the event loop which makes Thin so fast. Spawning threads to handle lengthy requests requires explicit configuration, but it is trivial to set. (This feature was developed in tandem with the Merb framework.)

Note that evented mongrel is also "single-threaded." [ok...maybe 2 threaded, but one main thread]

Ruby on Rails[edit]

Although simple tests show Thin to be faster than Mongrel, "the raw differences between Thin and Mongrel are dwarfed by the time spent in Rails."]


The configuration for Mongrel and Thin are very similar. They can both be configured using a YAML config file or using parameters in the command line.


Ruby 1.9[edit]

Mongrel does not yet run on Ruby 1.9.

Thin is Ruby 1.9 compatible as of version 0.5.1.

Mongrel does run on Ruby 1.9 if you do some trivial code changes.

Ruby on Rails[edit]

Mongrel has native support for Ruby on Rails in that you can just run script/server in your rails app and it will run rails with mongrel instead of webrick. Ruby on Rails now supports Thin as well, as of edge commit a93ea8. In earlier versions of Rails, Thin can be run with the thin command.

On production deployments, mongrel will be run with mongrel_rails command as well, and the options are similar for both.


Thin support will be built into the Merb 0.9 release.

"Thin support was added to Ramaze and Vintage frameworks." [3]

Since Thin is designed to run Rack applications, Thin can run any application from any framework that there exists a Rack adapter for. This includes Rails, Merb, Ramaze, Vintage, Halcyon, Mack, and several more (a more complete list of Rack-built frameworks exists on the Ramaze website). It should be noted that Rack comes pre-packaged with a Mongrel handler, so any Rack application that Thin can run, Mongrel can as well; however, this was not the original design of Mongrel.


Mongrel is known to be a steady Ruby server, already in use in many production environments.

Thin is still alpha version and not yet recommended to be used in production servers. A few noted Ruby web developers, however, are already switching over to Thin from Mongrel. [4] [5]



Both thin and mongrel support clustering. Thin comes with clustering built in, while mongrel's clustering support comes from a separate mongrel_cluster gem.


Thin has tracing support that mongrel does not have. Tracing allows the developer to see the exact HTTP transactions that are going through. [6]

Asynchronous response support[edit]

Thin has Asynchronous response support as of version 1.2.0 (codenamed Asynctilicious Supreme) [7].


Recently, the creator and main developer for Mongrel, Zed Shaw, left the Ruby/Rails scene with a long rant. Before he left, however, he left Mongrel into the hands of a development team that will keep up the work on Mongrel.

Marc-André Cournoyer created Thin using the Event Machine, Rack, and Mongrel libraries. Thin actually depends on the parser code in Mongrel and so is not completely independent from Mongrel.