Rails server (3) - what to use now?

I have been using Ruby Enterprise Edition and Passenger (for Apache since I am running Apache anyway for other things) for some time, but I am wondering if there is a new trend about what to use on servers currently. For example, I heard about Thin, Unicorn ... I also know that 1.9.2 is faster than REE, but I'm curious about using RAM. I would prefer it to consume less RAM even at the expense of some speed.

Thanks for all the tips.

+6
ruby ruby-on-rails ruby-on-rails-3
source share
4 answers
The passenger is still extremely strong, especially if the REE naturally supports 1.9 in the near future. The fact that your application may crash, however it will not affect anything else on your computer, is an amazing feature. Deploying code is extremely simple because the server will continue to accept connections, which means less frustration / stress for you.

However, in terms of comparisons:

Here is a great resource that checks various comparisons (including memory consumption) with all new servers.

It compares Slim, Unicorn, Passenger, TorqueBox, Glassfish and Trinidad:

http://torquebox.org/news/2011/03/14/benchmarking-torquebox-round2/

+6
source share

If you need minimal memory, you should try Thin. This one does not have a master worker like the Unicorn or Passenger, therefore it uses less memory. Suppose you have a very small application that needs to be run on a small virtual machine, then you can use 1 thin worker + nginx. I ran several rails of 3.2 applications using Thin + nginx + postgres on 256 MB virtual machines without sharing.

The unicorn is faster, but it needs a master worker. Well, if you want to work on Heroku, you can install 2 or 3 workers and be within 512 MB.

If your application is very large and you have too many lengthy requests, I would look at jRuby and Thinidad / Torquebox.

I have converted several applications from MRI + Sidekiq to jruby + Trinidad + Trinidad_Scheduler. I get about 100-200 req / sec using a pool of 50 threads on a Trinidad server!

What I like about jRuby is that you can combine everything on one Rails server. You can build cache_store on one JavaVM using EHcache, Scheduling, Background processing and real multithreading.

You do not need to run redis, memcached, resque or sidekiq separately.

I'm not saying that they are not good, I love sidekiq and resque, but you can reduce your complexity by combining everything on one process and getting high concurrency.

A more advanced and enterprise solution is Torquebox, it supports clustering and is super-scalable. But I had problems with the scam application on the torque, so now I stick to Trinidad.

The flaws of jRuby? Memory! The Trinidad server will use a minimum of 512 MB, up to 2-3 GB. In addition, for a Single Thread server, a single request from a rails application with Ruby-1.9.3 is approximately two times faster than the same jRuby request.

Another option is Puma, you can get full multithreading on MRI using puma. I myself could not get it stable enough in my applications.

So it all depends on your requirements, memory usage, full streaming and concurrency.

In addition to Passenger, take a look at Unicorn, Trinidad, Puma and Torkebox. These now seem to be the best rails servers.

There is a great book with the introduction of converting your Rails application to jRuby and deploying your application using several methods, such as Trinidad. http://pragprog.com/book/jkdepj/deploying-with-jruby

The Torquebox documentation is amazingly good. It is very detailed and explains whether it is really possible to use all the features of Torquebox. http://torquebox.org/documentation/

Hope my experience has helped.

+7
source share

The Mike Lewis link compares these different ruby ​​servers pretty well. My personal experience was with nginx / REE / Passenger, and that was good. I have not tried others, so I can not comment on this.

However, I can talk about using RAM. Your biggest memory savings will come from using 32-bit servers. In my experience (3x 3GB application servers), 64-bit REE / passenger processes took up to 2x as much RAM as their 32-bit counterparts. We saw a significant increase in performance from 64 to 32-bit servers, the rest remained unchanged. If your application does not require a 64-bit version, I would suggest starting the application server (and not the database) in a 32-bit version.

+4
source share

Passenger is still a very good choice, so you are not far behind time or something else. He is also actively supported and has a very good development team that makes a big contribution to the community. We used Unicorn and it was very good. Our favorite feature is the ability to update / ruby ​​/ nginx applications without dropping the connection.

+1
source share

All Articles