Hey all,

I have a weird situation.  I've got two different rails applications
running right now that seem to consume as much memory as exists on the
host machine.

The first application is a public-facing e-commerce website.  It has
ZERO performance issues - things load incredibly fast (both in terms
of end-user experience and milliseconds of rendering time on the
server side [visible through production.log]), but out of the 8GB of
memory allocated to the machine, the application is using all but
about 200 megs.

The second application is a much lower traffic internal maintenance/
outage reporting system used by several departments in the company.
We originally had given it 2GB of memory, and it consumed nearly every
bit of that, but squeezed that down to 512megs just to see what would
happen (since that system isn't public-facing).  Just as before, it
consumed all 512 megs.

Now here's the funny thing: doing a process list in top and ordering
by memory usage, ruby takes AT MOST 1.0% of memory and spawns at most
3-4 processes.  That means that ruby - and in that case, my rails
application - can't be the sole culprit, right?  Or am I missing
something here?

Both machines are VMWare virtual machines running Ubuntu 9.04 (and
yes, we plan to upgrade soon) with Passenger 2.2.5, Ruby 1.8.7 and
Rails 2.3.4.

We did an experiment with the larger machine to see what caused
issues, if anything.  I had our system administrator clone an exact
copy of the first machine (8GB memory machine), and we let it SIT
doing nothing all weekend (Friday - Tuesday) - absolutely no HTTP
requests were made to the machine whatsoever.  As I expected, memory
usage is minimal - about 520mb out of the 8GB assigned to it.

I just made some HTTP requests to the machine on the rails app in
question, and didn't see memory usage go up that much, if at all.
However, if it's indeed a true LEAK, we won't know for sure for some
time.  At this point I'm watching it to see what's up.

Another interesting point is that, according to our *nix admin, the
kill -9 command should FORCE the operating system to reclaim memory
used by runaway processes.  We were operating under the theory that
maybe a ruby process consumed memory, didn't give it up, AND didn't
report its use to the OS (so it wouldn't show up in top, for
example).  Well, assuming kill -9 will force memory to be reclaimed by
the OS, I've blown that theory out of the water by issuing a kill -9
on damn near every process related to ruby or apache on the second
virtual machine (after we expanded its memory for testing).  After
killing every apache and ruby process (and therefore, passenger),
memory usage had barely moved - maybe 35mb at most.

Our IT director believes it has to be something to do with Ruby,
simply because he doesn't see this behavior on any other machine where
Ruby is *not* installed or in use.  Given that sole fact, I'm inclined
to agree, but of course I'd like more than mere conjecture to go on.
In no way am I faulting Ruby or Rails - if there's a leak, it's most
likely my application; but killing the application entirely doesn't
restore memory, seemingly ruling out that theory.

So you can see why I'm confused!  Is there anything else I can do, any
other way I can check to see IF indeed it's my application, and if so,
what can I do (other than trimming AR statements, I already know that
one) to clamp down on memory usage?

Thanks guys.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to