Forum: Ruby on Rails Tweaking Rails to Reduce RAM Usage

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rails (Guest)
on 2006-03-25 00:36
Is there a way to tweak rails 1.0 or 1.1-rc1 to use less RAM?

I'm using a VPS (Linux UML) with < 160 MB RAM and would like to explore
ways to make rails run more efficiently under such constraints.

Are there articles/tips about this or do I need to look into this from
scratch?
Justin F. (Guest)
on 2006-03-25 04:56
(Received via mailing list)
Rails wrote:
> Is there a way to tweak rails 1.0 or 1.1-rc1 to use less RAM?
>
> I'm using a VPS (Linux UML) with < 160 MB RAM and would like to explore
> ways to make rails run more efficiently under such constraints.
>
> Are there articles/tips about this or do I need to look into this from
> scratch?

Two things I'm aware of:

1) don't use more FCGI processes than you need - one or two should be
fine unless you have many users

2) don't load Rails frameworks that you aren't using: see
    config/environment.rb around line 15:

   # Skip frameworks you're not going to use
   # config.frameworks -= [ :action_web_service, :action_mailer ]

Uncomment the second line shown if you are not using ActionWebService or
ActionMailer.

HTH

   Justin
Joseph K. (Guest)
on 2006-03-25 08:54
(Received via mailing list)
Another option is to recompile your binaries with -Os if your compiler
supports the flag (only very old versions of gcc don't use this flag
properly).  This does provide a sizable decrease in binary size and thus
the
code size in memory.
Chris McGrath (Guest)
on 2006-03-25 14:58
(Received via mailing list)
As well as the memory Rails uses, you should look at the memory it's
supporting processes such as the spawner / reaper are using. I have a
128Mb Xen based VPS and switched to using runit for process
supervision with the help of the capistrano-runit-tasks library I wrote.

I've just replied to Roberto S. in the ANN: capistrano-runit-
tasks 0.2.0 thread with more details so have a look at that.

Cheers,

Chris
This topic is locked and can not be replied to.