Prev | Current Page 475 | Next

Brad Ediger

"Advanced Rails"


??  http://mongrel.rubyforge.org/
320 | Chapter 10: Large Projects
Enter Mongrel: an HTTPapplication server. It supports several frameworks, the
most prominent being Rails. Instead of having your application servers speak
FastCGI, they can natively speak HTTP. This means, among other things, that you
can put them behind a hardware or software load balancer, and the dynamic
requests may not even need to hit a web server other than Mongrel. Alternatively,
you can proxy to them from a web server, as described previously.
Mongrel is very easy to install and control:
$ sudo gem install mongrel
$ cd my_rails_app
$ mongrel_rails start -d
(mongrel is running as a daemon)
$ mongrel_rails stop
Mongrel can be run as a service on the Win32 platform, using the mongrel_service
gem.
Remember: as an HTTPserver, Mongrel will happily serve static files in its docroot,
but it will be slower than a server optimized for static files. This is fine in development
mode (script/server defaults to Mongrel, even in development mode), but it
will be slow in production. For situations where performance matters, set up a front
end web server and check the logs to be sure it is serving all of the static assets.
Of course, managing several Mongrels in parallel can get tiring. That??™s why Bradley
Taylor created mongrel_cluster. It is a small library that manages parallel Mongrel
application servers.


Pages:
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487