Is it using GoldSpike's JavaSessionStore to manage the sessions?
This is the default unless jruby.session_store = db is set in web.xml.

JavaSessionStore creates byte arrays by marshalling the session data.
If this is the case, it might be worth trying the normal Rails session stores.

Cheers,
Robert


Raphaël Valyi wrote:
Hi,

I'm sorry, I'm progressing very slowly on the issue as time permits me.
My new tests again tend to prove Goldspkie has a leak while Webrick hasn't.
This time I loaded my server using a very basic request with no other
Java Integration involved except Golspike itself. I can't see any leak
on Webrick, so it's unlikely the app itself or Rails has got a leak.

I know I should have force the GC with JConsole, but I hadn't time to
do that in my dev env while I couldn't connect to my prod env with
JConsole - I can't understand why that failed by the way!

My server is Tomcat 6.013, java 1.6u2, Linux 2.6.18. I'm on JRuby
head, with last Goldspike public release.

I loaded the server with JMeter, about 10 thread requesting every 3
secs. Almost all request are being answered code 200.

Fresh Tomcat, only a few requests:

Class         Instance Count         Total Size
class [C         241560         10559832
class org.jruby.runtime.ObjectSpace$WeakReferenceListNode
283638         7941864
class [B         114083         6585746
class java.lang.String         230388         3686208
class [I         5143         3370844
class org.jruby.ast.CallNode         91649         3299364
class [Ljava.util.HashMap$Entry;         27502         2687420
class jregex.Term         27845         2673120
class java.util.HashMap$Entry         138551         2216816
class org.jruby.util.ByteList         104350         2191350


Tomcat eating 24% of my Ram after hundreds of requests:
PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
18   0  439m 233m 6320 S 20.0 23.5   6:29.32 java
Resolving 4184874 objects (after jhat)

Class         Instance Count         Total Size
class [C         241560         10559832
class org.jruby.runtime.ObjectSpace$WeakReferenceListNode
283638         7941864
class [B         114083         6585746
class java.lang.String         230388         3686208
class [I         5143         3370844
class org.jruby.ast.CallNode         91649         3299364
class [Ljava.util.HashMap$Entry;         27502         2687420
class jregex.Term         27845         2673120
class java.util.HashMap$Entry         138551         2216816
class org.jruby.util.ByteList         104350         2191350


Tomcat now eating 25% of my Ram after a few dozens of other requests:
PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16   0  439m 248m 6336 S 32.6 25.0   8:16.24 java
Resolving 4155328 objects (after jhat)

Class         Instance Count         Total Size
class [B         183149         22359030
class [C         308307         11898332
class [I         28122         9874916
class org.jruby.runtime.ObjectSpace$WeakReferenceListNode
267281         7483868
class java.lang.String         302485         4839760
class [Ljava.util.HashMap$Entry;         51167         4525672
class org.jruby.ast.CallNode         118416         4262976
class java.util.HashMap$Entry         229064         3665024
class org.jruby.util.ByteList         166546         3497466


Obviously the Ruby byte arrays are taking a lot of resources. they
might be normal String be they can be leak, still pretty hard to tell.

I'll try while forcing the GC but I fear I can't do that before the
middle of the next week now.

You guys that have deployed Goldspike can promise me you never saw a
leak? This leak has been there since even before JRuby 1.0 and either
on Tomcat 6 and Glassfish v2.

Also what sucks is that if I wait more closer to the server freeze, my
dump is so large that I can't inspect it with JHat (>400 Mo).

Alternatively this could be a JVM misconfiguration but I tried a bunch
of things what you guys are you using to launch your server?

Any help would be appreciated.

Raphaël Valyi.

On 7/18/07, Robert Egglestone <[EMAIL PROTECTED]> wrote:
I've had a quick run through the GoldSpike code, and can't see anywhere
that runtimes are referenced other than local variables.
The runtime pool creates at least "minIdle" runtimes, and will create up
to "maxObjects". However, as it stands it shouldn't decrease the number
of runtimes available.

The logs should show "Runtime X loaded" every time a runtime is created.

Cheers,
Robert


Charles Oliver Nutter wrote:
Raphaël Valyi wrote:

Hi all,


Since even before JRuby 1.0, My JRuby on Rails app never lasted more
than 24 hours in prod env when while being browsed by Google and Yahoo
bots.

I investigated on this recently, and, while I'm not completely sure,
it seems that JRuby (from 1.0 to head; Java 6u2; Linux 2.6.18) doesn't
leak when using Webrick as a web server (In dev mode I'm using webrick
and never saw any leak while loading my server and profiling/garbage
collecting with JConsole.)

But with Goldspike, either under Glassfish v2, either under Tomcat 6,
it seems that I'v got a very little memory leak that ends crashing my
server.

With the JMeter load tool, I was able to fill my RAM (total 1 Go) by
sending as much as several thousands of requests (at 2 Req/sec, all
answered 200). And when letting my server in the WWW, It crashes in
about 24 hours or less but with less request (so may be the
variablitity has some influence).

I never saw any error in my Ruby log file.

It seems that the objects eating my RAM a(after jmap and jhat) are
Ruby arrays of integers. I don't know were they do come from, but I'm
quite sure they don't result from my specific code. My session dump is
clean too.

The [I were suspicious but I'm not sure they're the culprit. There's
also a large number of constructs related to jregex, which does use [I
for various things. Is it possible there's a regex leak somewhere?

Other than that...in GoldSpike do runtimes ever go away/get collected if
not in use? Are there links from any server-wide state to the runtimes
that might keep them from going away?

Raphael: Any way you can track how many JRoR runtimes might be spinning
up in your process?

- Charlie
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to