Java and threading

hello,

I am seeing some issues where a hung up java process is consuming 100%
cpu
on 1 of 4 CPUs. This is hanging the JRuby app. Shouldn’t java be
threading
future requests to be used on other CPUs ?

Cpu0 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Cpu1 : 1.0%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Cpu2 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Cpu3 : 1.0%us, 1.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Mem: 4046588k total, 2310740k used, 1735848k free, 98688k buffers
Swap: 4192956k total, 0k used, 4192956k free, 542196k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4756 root 19 0 2526m 1.4g 10m S 101 36.0 4:39.27 java

Thanks
Adam

AD wrote:

hello,

I am seeing some issues where a hung up java process is consuming 100%
cpu on 1 of 4 CPUs. This is hanging the JRuby app. Shouldn’t java be
threading future requests to be used on other CPUs ?

Yes, unless that thread is holding a resource that the others need. Can
you try to get a stack dump to see where they’re stuf? It’s usually
Ctrl+\ or Ctrl+Break from the console where the app is running, or you
can ust jps+jstack.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I have attached the kill -3 output. Let me know if you guys see
anything
interesting here, hard for me to debug.

Also is there a way to optimize how many jruby processes get spawned for
an
app? What is a good number to use? Is thee a way to determine how many
are
being used ?

Adam

‘kill -3 PID’ may give that, too

----- Original Message -----
From: “Charles Oliver N.” [email protected]
To: [email protected]
Sent: Wednesday, July 16, 2008 5:12:14 PM GMT -06:00 US/Canada Central
Subject: Re: [jruby-user] java and threading

AD wrote:

hello,

I am seeing some issues where a hung up java process is consuming 100%
cpu on 1 of 4 CPUs. This is hanging the JRuby app. Shouldn’t java be
threading future requests to be used on other CPUs ?

Yes, unless that thread is holding a resource that the others need. Can
you try to get a stack dump to see where they’re stuf? It’s usually
Ctrl+\ or Ctrl+Break from the console where the app is running, or you
can ust jps+jstack.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

AD wrote:

I have attached the kill -3 output. Let me know if you guys see
anything interesting here, hard for me to debug.

Also is there a way to optimize how many jruby processes get spawned for
an app? What is a good number to use? Is thee a way to determine how
many are being used ?

I’d say start with 2 and scale up as you need. It’s going to depend on
how fast your app responds and how many concurrent connections you need
to be able to handle.

Looking at your trace, there’s a big fat Permgen error at the top, which
would mean you need to bump that up. The default in the JVM is usually
around 64M, so you might try going up to 128M. FYI, the “permanent
generation” holds compiled code, among other things, so app servers
frequently need to bump it up if they’re deploying many apps (or many
instances of an app, as in this case).

modify tomcat startup to pass -XX:MaxPermSize=128M to set it.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

any idea about the locked processes?

We tried a few other things too where we set a Timeout::timeout but
seems to
have no affect in tomcat only in mongrel under JRuby interestingly
enough.
The issue seems to relate to a syncronous process not responding (remote
http call), but I am trying to figure out why it is making the whole app
unresponsive to other users.

Thx
Adam

On Thu, Jul 17, 2008 at 4:57 PM, Charles Oliver N. <

Sorry forgot the file.

Adam