JVM Configuration
924317Mar 25 2012 — edited Mar 26 2012Hello Everybody!
I have a problem with an application in Java. The problem is described below:
The application creates 10 threads and evry threads communicates with each oother sending objects. To achieve this goal I serialize classes. Also these threads communicates with external applications using TCP/IP sockets.
Funcionality this should be a good application, but when I start testing the application with a lot of messages (transactions) I found the following issues:
1. When the quantity of messages reachs 6,000 transactions the consumes of CPU reach 80% o more, finally the application collapsed.
To resolve this problem, I changed the application with the following function after each sending.
wrieteObject.reset() -> I found out that reset eliminates of memory the object. So the access to the disk reduced.
2. Now, when the quantity of messages reach 40,000 transactions the quantity of memory increase more than it should be. The parameters setting for this application is:
java -Xms128M -Xmx256M -XX:+UseParNewGC
The problem is happening in an Server 1 when the quantity of memory available is 1G, but in my PC (2G available of memory) it works OK.
Another different between the Server 1 and my PC is that in Server 1 there are another applications running, but in my PC there is only this application.
I am not sure is :
A) my application is not eliminating something of memory, and I dont know how to prove it?? There is tool to examine what thread is causing this problem??
or
B) I need to make the correct tunning to the JVM. I also was proving wuth different ranges in Server 1 (greaters) and the problem always apperas. Maybe is missing special condition of JVM???
By the way, in my testing, I realize that the consume of Memory was greater than 256M, why if I set up 256M maximun value (java -Xms128M -Xmx256M -XX:+UseParNewGC ) ???
The following is the picture of TOP screen:
load averages: 3.02, 2.87, 2.84; up 156+19:28:04 03:11:09
340 processes: 337 sleeping, 1 zombie, 1 stopped, 1 on cpu
CPU states: 19.2% idle, 54.3% user, 26.5% kernel, 0.0% iowait, 0.0% swap
Memory: 2048M phys mem, 327M free mem, 4104M total swap, 3571M free swap
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
*1402 jpaope 39 59 0 315M 284M sleep 14:16 11.29% java*_ ----->>>> This is my application running and freezing when reach 40,000 transactions...!!!
1626 informix 11 1 0 955M 447M sleep 939:51 10.02% oninit
652 ccom60 1 11 0 156M 150M sleep 10:15 8.50% switch
12487 sps_ope 1 59 0 6280K 4464K sleep 0:00 2.10% ssh
1206 root 2 59 0 345M 5360K sleep 22.3H 1.92% epilog
654 ccom60 1 42 0 11M 6232K sleep 1:44 1.40% auth
1634 ccom60 1 47 0 954M 333M sleep 88:33 1.38% oninit
2129 jpa_ope 1 55 0 1920K 1424K sleep 1:36 1.33% ksh
818 ccom60 1 54 0 11M 3824K sleep 1:36 1.28% sw8583
249 daemon 6 59 0 5856K 2632K sleep 139:51 1.08% kcfd
26524 root 1 58 0 2952K 1840K sleep 79:16 1.02% praudit
658 ccom60 1 58 0 11M 5288K sleep 1:04 0.85% sw8583
595 ccom60 1 59 0 1896K 1240K sleep 0:54 0.80% cclog
2154 jpa_ope 1 57 0 9976K 4904K sleep 1:36 0.76% sshd
26522 root 2 59 0 3304K 1792K sleep 34:11 0.64% snarecore