SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is Ruby on Rails a server resource hog?

    I have installed RoR on my web server (Apache 1.3/FastCGI) and it is running fine. However if I watch the server load it will peak whenever the RoR app is loaded (it is a mephisto blog with 3 entrie). Now I have a client who is going to install his Ruby app on the server and I am concerned that there may be load problems.

    I have read many complaints about TYPO being a big resource hog and I was wondering if this a development issue (bloated apps) or a ruby issue.

    The server is a 4cpu CentOS VPS with 768mb ram and cPanel.
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Typo's kind of a bloated app yes.

    Have you considered a more efficient setup, like mongrel_cluster and Apache 2 or LiteSpeed? FastCGI is probably the most ubiquitous way to deploy Rails apps but it's not really the most efficient. People run VPSes with mongrel and 64 or 128mb of RAM and do fine with a single blog/app.

  3. #3
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would love to go to Apache 2 but until cPanel starts to support it I cant make th move (as far as I understand). They DO look like they are going to support it some time soon (soon in cPanel time may be many months) since the edge release now provides apache 2 support (but is not stable).

    I am looking at mongrel with pound which was suggested on a previous post but I keep getting other suggestions and don't quite know which is best. I think one thing that is missing in the RoR community is a solid 'recomended' install process. The RoR site still recommends fastcgi as the way to go and most official install instructions go with fastcgi as well.
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman

  4. #4
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cpanel sucks... why use it?

    if you have to have a control panel, I would recommend Direct Admin.

    But anyway, yes, rails apps can be a significant resource hog especially if you make "mistakes" when coding it. If you avoid stuff like using RMagick and other blunders, it should be fine. I run a few high traffic rails sites and manage to keep the mongrel processes under 200MB total and CPU load is never really that high.
    Ohai!

  5. #5
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It has been suggested that I use nginx ( http://sysoev.ru/en/ ) as a go between apache 1.3 and mongrel since it is faster than pound. I never heard of enginx but it seems to be pretty popular in Russia. Anyone used this method?

    I am stuck with cPanel for now so I can't switch.
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman

  6. #6
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I run Rails apps on my VPS using Nginx as the front end server, proxied to mongrel. Alternatives to this are lighty/pound or Apache 2.2. I use Nginx because I have limited memory on my VPS and Apache is a resource hog.

    I still have to ask the cpanel question. Why are you "stuck with it"? Why do you need to use it at all?

  7. #7
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The main reason I am stuck with cPanel/whm is that it is already in place. I have around 25 domains/accounts setup and don't have the time to port this over to another setup. The VPS is used to host my sites/apps (mostly php/mysql and now Ruby too) and a hand full of web-design clients with mostly static sites with a few in PHP/mysql. I guess I could go 'commando' but I don't have the time to mess around and figure it all out. If I did not host 'clients' I would feel better about making a switch, but I cant do this until I am sure that I will not screw it up (I don't mind screwing up on my own sites, but cant do this to my clients).

    They seem to be moving a little bit faster with the apache 2 support so that is promising.

    I have been trying to learn how to set it up so that I can use nginx together with apache 1.3. I know of someone who has this setup but he is short on words in explaining the process so I have been going blind reading on-line today to see if I get some light o this...so far things are still a bit dark, cpanel may be apache 2 ready before I figure this out

    My most recent idea is to use mod_proxy to get apache 1.3 to talk to mongrel, but I am not sure how much better this will be than using fastcgi since there will still be no load balancing taking place. I have even gone so far as contacting a few server admins for hire but they were not available for this sort of work. Looks like I will be doing plenty of reading tomorrow as well.
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman

  8. #8
    SitePoint Addict myrdhrin's Avatar
    Join Date
    Jul 2004
    Location
    Montreal
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dev_cw,

    I've used mod_proxy on my own site. I still don't trust mongrel totally as a front end and I have other site running that make good use of Apache.

    And if you worry about loadbalancing mod_proxy along with a little mod_rewrite will do the trick for you
    Jean-Marc (aka Myrdhrin)
    M2i3 - blog - Protect your privacy with Zliki

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need to use nginx AND Apache. Just use one or the other - if you want to proxy to mongrel you really need to look at using 2.2 because it has mod_proxy_balancer. Alternatively you can use lighty and pound. Perhaps you could use Apache 1.3 and Pound too?

  10. #10
    SitePoint Addict myrdhrin's Avatar
    Join Date
    Jul 2004
    Location
    Montreal
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a reason nobody mentionned Lighttpd?
    Jean-Marc (aka Myrdhrin)
    M2i3 - blog - Protect your privacy with Zliki

  11. #11
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to follow up on this. I now am running Pound+apache1.3+mongrel+mongrel_cluster successfully. First of all I was supprised that mongrel_cluster is not any lighter than fastcgi was on the server, it actually seems a bit heavier. Where fastcgi would cause load peaks during requests the mongrel cluster will cause a constant load without any peaks. However I also noticed that with mongrel the rails app will respond a little bit faster.

    Here are the conclusions that I came to during this experience:

    1) Hosting Ruby/Rails is not easy. I was under the impression that it would be like hosting php or perl where you just install the language and do some basic config and let it rip. The setup needs to be configured for each app (in my case manually). For example I need to add a reference for each app in my pound config file to make the proxy/load balance to the mongrel cluster for that app (one cluster per app).

    2) Installing Ruby/Rails and all the additional goodies is really easy.

    3) Most of the docs (actually all the docs I found) regarding deployment assume that you are hosting one app per server. I was unable to find any docs regarding hosting multiple sites and serving ruby/rails with php or any other standard language on the same server.

    4) Rails is for apps, rails is not for sites! I don't think that it is worth the extra considerations to use RoR to build a static site. This may sound obvious to most. You can use RoR to do a static site but all the extra hosting hassles are not worth it.

    5) If the article you read about deployment is over a few months old it is most likely obsolete! Since RoR development is moving at lightning speed you need to be ware of outdated info. For example on the rubyonrails site it will say that the best way to go is with FastCGI, but now with mongrel fastcgi is a no-no.

    6) nginx is a strong up-and-comer in the server world. Based on my study it is a great stand-alone server that can also be a load balancer and proxy server. It is popular with RoR developers since it will also serve the static stuff that mongrel will not do so well. However I suspect that in the future mongrel will handle these files more efficiently and this point will be mute. In my setup I was able to config pound to send all the static file requests over to apache (.css .png .js etc...). This will let mongrel only handle the ruby/rails stuff and apache does all the rest.

    Anyway, we now are up and running and I am ready to start learning what this is all about. My books should be arriving any day now. Thanks for all the help folks

    Cheers,
    Shane
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •