AppEngine JRuby - OutOfMemoryError:Java 堆空间 - 可以解决吗?
我使用 AppEngine JRuby on Rails(SDK 版本 1.3.3.1) - 我经常遇到的一个问题是,在几次请求之后,服务器变得非常慢,直到它死掉并在终端(OSX)上抛出 OutOfMemoryError 。
请求本身非常轻量级,只不过是使用 DataMapper 查找实体或保存它。
在appspot上,这个问题没有发生。
有没有办法扩大JRuby的堆空间?
异常日志:
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)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置
-XX:MaxHeapSize
和-Xmx
虚拟机参数set
-XX:MaxHeapSize
and-Xmx
vm parameters