Helping early-stage companies turn great ideas into even greater products Rapid scale-up and dependable delivery with unsurprassed passion and experience Swift and predictable results combined with quality and cost performance
banner

Scaling Ruby applications

Bookmark and Share

The question “how you gonna build scalable Ruby application” is quite usual for our potential clients. While it is (naturally) impossible to answer this question within several minutes, there are some aspects to the answer, which we see important to mention. Here are these aspects:

1. First of all, we’ve recently moved from the schema with Apache as a load-balancer with Mongrel servers farm behind to the schema with Zeus (http://www.zeus.com/products/zxtmlb/index.html) as load balancer and farm of Apache with Phusion Passenger module which ‘plays’ Ruby scripts (http://www.modrails.com/). We find this approach to be more effective than Apache+Mongrels, including more effective handling of caching strategies.
2. Talking specifically about database level caching, we use either cashing on Active Record level or external cashing libraries. Our favorite is Memcache (www.danga.com/memcached/).
3. Talking again about DB optimization, we put much attention to effective DB indexing and optimization of SQL queries, including (in some rare cases) usage of stored procs.
4. In some specific cases, which include very heavy usage (10-12 000 web quieries per minute) we use nginx (http://sysoev.ru/nginx/) web server which works (as we’ve found out) more effectively with static, cashable data then Apache. It is also worth mentioning though that both Apache and nginx are able to work with memcached via pluggable modules.

As mentioned, these are just some aspects, but general rule is that you choose specific cashing approach for eash app you build – depending on functionality of this app, its architecture and of course level of load it experiences.

Tags: ,

This entry was posted on Wednesday, August 12th, 2009 at 4:52 pm and is filed under Web 2.0 technologies.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

4 Responses to “Scaling Ruby applications”

  • This reminded me story, when guys from Twitter tried to scale and optimise its Ruby source and … moved to Scala critical part of application (message queue).

    As for Rails it is better to run it on Enterprise Ruby.

    Zeus is good, but it is pretty expensive. For startups I would recommend use open-source alternatives, like HAProxy. We have some problems with it, and it is not that good like Zeus, but it is free.

    Also to get rid of high database load, it is possible to use several replicated databases.

  • Jeffrey St.Clair says:

    Could someone please translate this into English and let me know why I should be interested in what you are trying to say here?

  • Jeffrey,

    Lol, this was written by some Ukrainian developer :) And we, Ukrainians are not native speakers. Most funny thing, I read it without any problem. Ukrainian mind.

  • A wonderful article…. In my life, I have never seen a man be so selfless in helping others around him to get along and get working. I feel good that there are people like you too. Thanks for this great weblog of yours. Its surely going to get me to go to higher places!

Leave a Reply