Hi!
Thanks for your reply!
If Java and Tomcat is multi-threaded applications, I still don't understand why I see
Java on only one CPU when I use the top function in Linux. Here is a snapshot from a
medium stress-test load:
15:02:23 up 1 day, 22:23, 1 user, load average: 1,79, 1,56, 0,74
82 processes: 76 sleeping, 5 running, 1 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 50,0% 0,0% 7,4% 0,0% 4,6% 0,5% 37,2%
cpu00 31,9% 0,0% 8,9% 0,0% 5,9% 1,1% 51,9%
cpu01 68,1% 0,0% 5,9% 0,0% 3,3% 0,0% 22,5%
Mem: 1286812k av, 887436k used, 399376k free, 0k shrd, 162608k buff
462864k actv, 193060k in_d, 256k in_c
Swap: 3072216k av, 0k used, 3072216k free 392952k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
745 root 25 0 98,4M 98M 7400 S 42,7 7,8 158:48 0 java
6048 mysql 15 0 101M 101M 2576 S 0,9 8,0 1:12 1 mysqld
6049 mysql 25 0 101M 101M 2576 R 0,6 8,0 1:49 1 mysqld
13138 root 15 0 1292 1292 904 R 0,3 0,1 0:03 0 top
6400 mysql 25 0 101M 101M 2576 S 0,1 8,0 0:00 0 mysqld
6410 mysql 25 0 101M 101M 2576 S 0,1 8,0 0:00 0 mysqld
6528 mysql 25 0 101M 101M 2576 S 0,1 8,0 0:00 0 mysqld
1 root 15 0 500 500 444 S 0,0 0,0 0:08 0 init
2 root RT 0 0 0 0 SW 0,0 0,0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0,0 0,0 0:00 1 migration/1
4 root 15 0 0 0 0 SW 0,0 0,0 0:00 0 keventd
5 root 34 19 0 0 0 SWN 0,0 0,0 0:00 0 ksoftirqd/0
6 root 34 19 0 0 0 SWN 0,0 0,0 0:00 1 ksoftirqd/1
9 root 25 0 0 0 0 SW 0,0 0,0 0:00 0 bdflush
7 root 15 0 0 0 0 SW 0,0 0,0 0:02 0 kswapd
8 root 15 0 0 0 0 SW 0,0 0,0 0:03 0 kscand
10 root 15 0 0 0 0 SW 0,0 0,0 0:04 0 kupdated
11 root 25 0 0 0 0 SW 0,0 0,0 0:00 0 mdrecoveryd
20 root 15 0 0 0 0 SW 0,0 0,0 0:01 0 kjournald
75 root 25 0 0 0 0 SW 0,0 0,0 0:00 1 khubd
145 root 15 0 0 0 0 SW 0,0 0,0 0:05 1 kjournald
146 root 15 0 0 0 0 SW 0,0 0,0 0:00 0 kjournald
147 root 15 0 0 0 0 SW 0,0 0,0 0:11 0 kjournald
148 root 15 0 0 0 0 SW 0,0 0,0 0:02 1 kjournald
492 root 15 0 568 568 492 S 0,0 0,0 0:00 1 syslogd
496 root 25 0 448 448 392 S 0,0 0,0 0:00 0 klogd
506 root 15 0 444 444 384 S 0,0 0,0 0:23 1 irqbalance
523 rpc 25 0 560 560 488 S 0,0 0,0 0:00 0 portmap
542 rpcuser 25 0 716 716 636 S 0,0 0,0 0:00 0 rpc.statd
622 root 15 0 1460 1460 1228 S 0,0 0,1 0:02 0 sshd
636 root 25 0 792 792 684 S 0,0 0,0 0:00 1 xinetd
646 root 15 0 488 488 408 S 0,0 0,0 0:00 0 vsftpd
667 root 15 0 2584 2584 1892 S 0,0 0,2 0:07 0 sendmail
676 smmsp 15 0 2260 2252 1708 S 0,0 0,1 0:00 1 sendmail
754 root 15 0 464 464 408 S 0,0 0,0 0:00 0 gpm
763 root 15 0 612 612 544 S 0,0 0,0 0:00 0 crond
806 daemon 15 0 556 556 492 S 0,0 0,0 0:00 0 atd
842 root 15 0 4972 4972 1900 S 0,0 0,3 0:07 1 miniserv.pl
846 root 15 0 416 416 368 S 0,0 0,0 0:00 1 mingetty
847 root 15 0 420 420 368 S 0,0 0,0 0:00 0 mingetty
848 root 15 0 420 420 368 S 0,0 0,0 0:00 1 mingetty
849 root 21 0 420 420 368 S 0,0 0,0 0:00 0 mingetty
850 root 17 0 420 420 368 S 0,0 0,0 0:00 1 mingetty
851 root 17 0 416 416 368 S 0,0 0,0 0:00 1 mingetty
6018 root 25 0 1128 1128 984 S 0,0 0,0 0:00 1 mysqld_safe
6050 mysql 20 0 101M 101M 2576 S 0,0 8,0 0:00 0 mysqld
6051 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:00 0 mysqld
6052 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:00 0 mysqld
6053 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:10 0 mysqld
6054 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:00 1 mysqld
6055 mysql 15 0 101M 101M 2576 S 0,0 8,0 1:17 1 mysqld
6056 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:29 0 mysqld
6057 mysql 15 0 101M 101M 2576 S 0,0 8,0 0:09 1 mysqld
13091 root 15 0 2084 2084 1716 S 0,0 0,1 0:00 1 sshd
13093 root 23 0 1336 1336 1128 S 0,0 0,1 0:00 0 bash
6369 mysql 25 0 101M 101M 2576 S 0,0 8,0 0:00 1 mysqld
6385 mysql 25 0 101M 101M 2576 S 0,0 8,0 0:00 1 mysqld
As you see, there's only one Java service on CPU 0, and MySQL is running on both CPUs.
Any explanation for this?
The web application running is a web publishing system based on web contents stored in
a MySQL database. So there's lots of SQL queries, but fron the info above, java seems
to be the bottleneck in the system.
Any help to increase the performance is appreciated.
Thanks
Jens Ove
----- Original Message -----
From: "Peter Guyatt" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>; "Jens Ove Lillegraven" <[EMAIL PROTECTED]>
Sent: Wednesday, November 12, 2003 4:31 PM
Subject: RE: How to tune Tomcat and Java?
> Hi There
>
> sorry sent the last one before it was ready ;-)
>
> Java and Tomcat are both multi-threaded applications. So they are both
> using more than one CPU (if available).
>
> If it is using 50% of one processor then it is using 100% CPU on that
> processor, since its 50% of the actual processing capacity.
>
> Check for an infinate loop without a sleep in your code, especially if you
> are attempting to connect a client socket to a server since linux does not
> wait before throwing an exception.
>
> Thanks
>
> Pete
>
> -----Original Message-----
> From: Jens Ove Lillegraven [mailto:[EMAIL PROTECTED]
> Sent: 12 November 2003 15:17
> To: [EMAIL PROTECTED]
> Subject: How to tune Tomcat and Java?
>
>
> Hi,
>
> We have a problem in that the Tomcat (java) process is the bottleneck and is
> using only one CPU.
> There will be high load on the server when it is put online, so we are
> stress testing it offline now. Using the top command in Linux during the
> stress test, it seems that java is the bottleneck of the system. But it uses
> not 100%, but about 45-50% of one CPU. We get no http error, the page
> performance (pages pr. second) is just getting worse as we put on more
> stress load. The max memory consumption is set to 300M, but I've never seen
> java using more than 111M. I suppose the throughput would have increased if
> both CPUs could be used, but is Java (Tomcat) a single processor
> application? The network throughput has a maximum average of 500kbps
> (kilo-bits) during the stress test, and should manage much more.
> Anyone who know how to make java and Tomcat performing better?
>
> Details of hardware and innstalled applications:
> Compaq ProLiant 6000, 2 x PII Xeon 400MHz, 1,3GB RAM
> Red Hat Linux Enterprise 3 ES
> J2EE: j2sdkee-1_3_1-linux
> J2SE: j2sdk-1_4_2_02-linux-i586
> Tomcat: 4.1.24
> MySQL: 4.0.16
>
> Tuning Tomcat memory (done):
> in /usr/bin/dtomcat4:
> CATALINA_OPTS="-Xmx300M -Xms100M $CATALINA_OPTS $JPDA_OPTS"
>
> MySQL has been tuned, and is running very well.
>
> Thanks
> Jens Ove
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]