diffrence between mongrel and mongrel cluster? - ruby-on-rails

Can anybody provide a brief explanation of the differences between mongrel and mongrel cluster?

Mongrel is a web server that can handle one request at a time. In order to handle multiple requests, you want to run multiple mongrels. A proxy server (i.e. apache) will sit in front of the servers and listen on port 80 and then relay the web requests to an available mongrel. Mongrel cluster is a gem that manages the launching of the mongrels, stopping, restarting and running it in the right environment with the right user. It abstracts the individual mongrels as workers so you don't need to worry about them (until things go wrong). All of that is managed by a configuration file usually located with the application.
Tass and Larry K are correct though. If you are looking at a new setup, think about passenger or unicorn. Both are great, unicorn is a bit more complicated and I would not recommend it to a beginner.

Mongrel cluster is multiple mongrel instances. Then the web server rotates amongst them to handle incoming calls.
But these days the cool kids tend to use Passenger (and often the related Enterprise Ruby too)

Mongrel cluster is somewhat of outdated, today you use unicorn. The github guys switched too.

Related

Using unicorn or passenger without nginx? [duplicate]

This question already has an answer here:
Is it necessary to put Unicorn behind Nginx ( or Apache)
(1 answer)
Closed 8 years ago.
I've been reading up on rails deployment and it seems for the two options I'm considering, unicorn and passenger, the tutorials always put them behind a server like nginx. I was under the assumption that both unicorn and passenger were fully functioning web servers themselves. So
Why are they always placed behind something like nginx?
If I use a load balancer nginx or HAProxy, can I have the load balancer directly distribute requests to unicorn or passenger, or do I still have to place them behind nginx?
Unicorn must be placed behind Nginx, by its author's design. The Phusion Passenger Design & Architecture document explains why some app servers are designed to be placed behind Nginx. Basically, it has got to do with I/O concurrency handling and I/O security.
Phusion Passenger however does not need to be placed behind Nginx. Phusion Passenger integrates into Nginx, as an Nginx module. Even the Standalone mode of Phusion Passenger does not need to be placed behind Nginx, because its Standalone mode utilizes a lightweight Nginx core and thus already properly implements I/O security.
If you use HAProxy, you can have it directly connect to Unicorn as long as you configure HAProxy to perform both request and response buffering. For Unicorn, buffering is key. Phusion Passenger on the other hand doesn't care, it works fine regardless of whether you configure buffering or not.

Start Unicorn using ssl in development

I'm migrating my rails app (still in development) from Thin to Unicorn. My app uses config.force_ssl = true.
When using Thin I could just write:
thin start --ssl
My question is: What is the equivalent way to start Unicorn with ssl in development?
If I correctly understood your question, you're trying to run unicorn on port 443.
This is a bad idea.
Instead, to achieve the same goal, I would suggest, run unicorn on an unprivileged port (above 1024), or better on a unix socket, and switch Nginx before, passing all static stuff directly trough nginx, and the rails stuff, trough unicorn.
I know this doesn't answer your question, but for the user, it will work exactly the same, with some benefits when your app server (unicorn) crashes, for example a nice rendered 502 error page served via nginx instead of a plain network error message seen in the browser of your users.
You can with this solution run X different applications on the same port, with different subdomains. a must have for a development machine with many projects.

What are different web server options on Heroku?

I recently deployed an app and am using WEBrick, and was considering on switching to Thin. I am wondering on the different options that exist and are best for a heroku environment?
Thanks.
Provided you're on Cedar stack you can use whatever you want - Thin works, you are able to get excellent performance out of Unicorn though on Heroku - http://blog.railsonfire.com/2012/05/06/Unicorn-on-Heroku.html
(Asummption: You don't mean WEB server (i.e Apache or Nginx), but your application process)
The only real constraint is what you can run on Linux. Nginx is the proxy that is used by the Heroku stack - but behind that it's up to you.
I've seen stuff running Thin, Webrick and Unicorn with no problems.

rails development server for windows

I need a recommendation for a rails web server to use for development on windows. I was happy with the default rails server until I had to handle two concurrent requests which it does not support (a page calls an internal rest service). I want to keep the "rails s" experience, so which is the simplest server that support my needs?
To my knowledge, there is no Windows-compatible Rails web server that is multi-threaded or concurrent out of the box.
You will need to spawn multiple back-end servers (we use mongrel, you could use thin instead) and then use/configure a proxy server (we use nginx) in front of them to handle multiple requests concurrently on Windows.
This blog post describes setting up Thin and nginx on Windows, once running you can edit the nginx.conf to proxy to multiple thin instances/ports.

Does ruby on rails have issues with regards to max # of threads the server and serve?

Does ruby on rails have issues with regards to max # of threads the server and serve?
i.e. you have to run multiple instances of the server if you reach high load?
Ruby-on-rails is by design single-threaded. To be able to server multiple users efficiently there are several solutions:
use Ruby Enterprise Edition and Phusion Passenger
use a cluster of mongrel services, for which loads of alternatives exist (mongrel-cluster, or using apache, nginx, ... to dispatch to different mongrels)
Does that help?

Resources