views:

113

answers:

1

I use AppEngine JRuby on Rails (SDK version 1.3.3.1) - a problem I encounter often is that after a few requests the server is getting really SLOW, until it dies and throws OutOfMemoryError on the terminal (OSX).

The requests themselves are very lightweight, not more than looking for an entity or saving it, using DataMapper.

On appspot, this problem is not happening.

Is there any way to enlarge the heap space for JRuby?

The exception log:

    Exception in thread "Timer-2" java.lang.OutOfMemoryError: Java heap space
Apr 29, 2010 8:08:22 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Error for /users/close_users
java.lang.OutOfMemoryError: Java heap space
    at org.jruby.RubyHash.internalPut(RubyHash.java:480)
    at org.jruby.RubyHash.internalPut(RubyHash.java:461)
    at org.jruby.RubyHash.fastASet(RubyHash.java:837)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2998)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2992)
    at org.jruby.RubyArray.op_diff(RubyArray.java:3103)
    at org.jruby.RubyArray$i_method_1_0$RUBYINVOKER$op_diff.call(org/jruby/RubyArray$i_method_1_0$RUBYINVOKER$op_diff.gen)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146)
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
    at org.jruby.runtime.Block.yield(Block.java:194)
    at org.jruby.RubyArray.collect(RubyArray.java:2354)
    at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.gen)
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
    at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:98)
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:183)
A: 

set -XX:MaxHeapSize and -Xmx vm parameters

Bozho
Thanks, can you please be more specific on how doing it?
elado
OK seems like dev_appserver.rb . --jvm_flag=-Xmx1024m is the solution.
elado