Scalability in RoR !!! Please reply ASAP

Hi all,

I am right now developing the customized web portal in RoR framework
and using MySQL as database.

I am facing the problem in terms of no. of users it can support.I am
hostong the application on a normal desktop configuration server which
is 80GB HDD and 1GB RAM.Now,as soon as it reaches around 100 users,the
CPU usage becomes 100% and the server stops responding.

Now,I am not able to figure out whether it is a problem of
1)Not using the connection pooling mechanism correctly in RoR
2)Not using the higher capacity server
3)Something else

Please post your feedback on this scalability issue.It will be very
helpful to me and my company.

Hardik Shah

What server OS are you running? What server are you using, as well as
what database and the versions?

Hi Todd,

Thanks for the reply.Here are the details u asked.

Server OS :- Red Hat Enterprise Linux
Language :- Ruby 1.8.4
Framework :- Rails Framework 1.1.6
Database :- MySQL 5.0.24
Web Server :- Apache 2.0.46 with Fast CGI 2.4.0 / mod_fast CGI


If you’re already done all of this, I apologize. To be honest, I’m new at Ruby on Rails, however I’ve been developing enterprise level J2EE Apps (minimum 10 web nodes in a cluster) for several years now. Here are some steps you can take to evaluate where the problem is.

  1. Run the ‘top’ command, and see where you processor is spending the most time. Is it in wait or idle state, most likely its in wait.

  2. Check your Memory and Swap in top, see if you’re maxing out your RAM. Swapping causes a lot of performance issue since you’ll be writing to disk

  3. Check which process takes the most % of your CPU time. In my experience with ROR, its been the database.
    If you database is spending the most time there are 3 options I can give you.

  4. Evaluate and profile your code. If you have a lot of associations such as has_many, or belongs_to, ROR will issue a query for each of these associations as the page is loading. You can improve performance by early fetching each one. Take a look at the ActiveRecord API here Look for the “:include” option.

  5. Are you connecting to mysql via TCP IP or socket? If you’re connecting with TCP/IP, try using a socket.

  6. If none of this helps you may want to separate your web node from your MySQL Node. This isn’t cheap, so your best bet is to make the code more efficient.

Hope this helps,

Thanks Tood,

I am forwarding ur details to my development team.I will update you
with the results they get by following the process mentioned by you.