Memory and embedded jruby

I recently gave JRuby a try as an embedded interpreter for some simple
ruby
scripts (i.e., just define some constants) in my web app at work. It
worked
well, but the server is now experiencing frequent OOM errors. I haven’t
yet
put a profiler on it, but JRuby is the only real addition in a system
that’s
been humming along fairly well until now. I’m using the default
constructor,
which looks like it will use a singleton instance. Basically, I set it
up as
a Spring bean with no init parameters.

What are the memory requirements for JRuby Embed? I’d like to continue
using
it, but not if my server falls over every day or so. Is there some
configuration option I’ve missed?

Thanks
Derrick

Hi Derrick

On Sun, Jan 24, 2010 at 9:41 PM, Derrick S.
[email protected] wrote:

I recently gave JRuby a try as an embedded interpreter for some simple ruby
scripts (i.e., just define some constants) in my web app at work. It worked
well, but the server is now experiencing frequent OOM errors. I haven’t yet
put a profiler on it, but JRuby is the only real addition in a system that’s
been humming along fairly well until now. I’m using the default constructor,
which looks like it will use a singleton instance. Basically, I set it up as
a Spring bean with no init parameters.

Can you put the code or code fragment that causes OutOfMemoryError?
That will help to figure out where the problem comes from.
If you haven’t tried JRuby trunk version, would you give it a try. I
fixed one bug caused OOM.

What are the memory requirements for JRuby Embed? I’d like to continue using
it, but not if my server falls over every day or so. Is there some
configuration option I’ve missed?

There’s no JRuby Embed specific memory requirement or memory related
configuration option.

-Yoko

Thanks
Derrick


Writer. Programmer. Puzzle Designer.
http://www.obsessionwithfood.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Do you know if you are running out of heap, permgen, or other? I don’t
see
heap leaks in my JRuby Embed apps. But if your use of the interpreter
causes JRuby to compile many new classes, these generally don’t get
garbage
collected by default. In this case you may need to increase the permgen
and/or switch to a garbage collector that can GC class data. An extreme
production example that fixed a large app that liked to fall over with
OOMEs:

-XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC

But from what your application sounds like, I suspect you shouldn’t be
needing to compile lots of classes. So like Yoko says, any details you
can
share about your usage might help troubleshoot.

What are the memory requirements for JRuby Embed? I’d like to continue
using

Thanks, all.

My OOMs are in PermGen. This is essentially a default jetty instance, so
it
probably isn’t using ConcurrentMarkSweep and probably has a default
PermGen
allocation. (Heap allocation is 500m to 1500m.) In addition to my
webapp,
which contains JRuby and Spring, among others, jetty is running Hudson
(and
a webapp that’s just JSPs). So there’s some load for sure.

But my whole webapp probably has about 30-40 classes at this point in
development. It’s still not even really in testing, though other members
of
my dev team are starting to rely on the server being there.

I’m using JRuby in a very limited way at the moment: Basically, I wanted
SQL
queries that were nicely formatted using here documents instead of the
clunky Java “blah” + " blah " + " blah." The plan is to use it more for
a
variety of things, but I thought this would be a good trial balloon.
(See
http://programmingobsession.blogspot.com/2010/01/polyglot-programming.htmlif
you want more details.)

Here are some things I’m trying now to keep things tight:

  1. Enforce singleton in the constructor of the interpreter (for the
    current
    prototyping work, this is fine.) I believe this is the default, but I
    set it
    explicitly to be certain.

  2. Set loadPaths explicitly to /WEB-INF/classes. It seems like if I
    don’t do
    that, JRuby might try to bring in lots of outside classes? I’ve read up
    on
    the classpath/loadpaths distinctions, but I’m not sure I fully
    understand
    what it’s doing.

I’m letting it run now to see if that fixes anything.

On Mon, Jan 25, 2010 at 12:32 PM, Rob H.

Hi Derrick,
add -XX:+PrintGCDetails to java startup parameters,
then You will be able to see to what value PermGen is set.

Best greetings,
Paweł Wielgus.

2010/1/25 Derrick S. [email protected]:

my dev team are starting to rely on the server being there.
prototyping work, this is fine.) I believe this is the default, but I set it
wrote:

needing to compile lots of classes. Â So like Yoko says, any details you can
Writer. Programmer. Puzzle Designer.
http://www.obsessionwithfood.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

i’m definitely interested in hearing how this went. Under most normal
execution we shouldn’t blow permgen, but the default setting on
Hotspot is currently very low (and the JVM guys acknowledge that it
sucks, too).

On Wed, Jan 27, 2010 at 10:09 AM, Derrick S.
[email protected] wrote:

Best greetings,

PermGen

on

Do you know if you are running out of heap, permgen, or other? Â I don’t
-XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC

  http://xircles.codehaus.org/manage_email


Writer. Programmer. Puzzle Designer.
http://www.obsessionwithfood.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

So far so good. I upped PermGen and kept an eye on the GC output. I’m
still
confused, though, as I didn’t see PermGen even getting up to normal
bounds.
As far as I know, usage is the same.

So I’m continuing to keep an eye on it.

On Mon, Feb 1, 2010 at 8:01 AM, Charles Oliver N.

Hi, Pawel.

Thanks. I set that up yesterday and have been monitoring the output.
Behavior was fine throughout the day; I’ll see what it looks like today.

2010/1/27 PaweÅ‚ Wielgus [email protected]