Hi,
I had done some stress tests on Apache Tomcat/7.0.47 and found that tomcat
didn't taken full advantage of hardware resources.I had used Apache Benchmark
tool(ab) to do benckmark,and then monitor the jvm instance of tomcat via
jvisualvm.In the benchmark,I just test the response time of request a jsp.
The CPU usage is not high,about 20%,even when the concurrent requests increased.
So how can I to do some performance tuning to make tomcat 7 take full advantage
of hardware resources?
The test enviroment:
andy@test80:~$ uname -a
Linux test80 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC
2013 x86_64 x86_64 x86_64 GNU/Linux
andy@test80:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 44
Stepping: 2
CPU MHz: 1596.000
BogoMIPS: 4800.19
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 12288K
NUMA node0 CPU(s): 0-3,8-11
NUMA node1 CPU(s): 4-7,12-15
andy@test80:~$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
andy@test80:~$ vmstat -s
82481856 K total memory
81243296 K used memory
51191508 K active memory
27359516 K inactive memory
1238560 K free memory
454584 K buffer memory
46734728 K swap cache
33542140 K total swap
11836 K used swap
33530304 K free swap
3259773994 non-nice user cpu ticks
172256 nice user cpu ticks
137055078 system cpu ticks
28564934681 idle cpu ticks
17736327 IO-wait cpu ticks
2324 IRQ cpu ticks
7998142 softirq cpu ticks
0 stolen cpu ticks
39740382 pages paged in
71293969233 pages paged out
14159 pages swapped in
73239 pages swapped out
2381549755 interrupts
1089236704 CPU context switches
1446432805 boot time
2733476 forks
catalina.sh:
CATALINA_OPTS='-Xms2g -Xmx2g -XX:PermSize=500M -XX:MaxPermSize=500M -Xss256K
-XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC
-XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled
-XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0
-XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M
-XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0
-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=10.241.14.80
-Dcom.sun.management.jmxremote.port=60108 -Djava.net.preferIPv4Stack=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false'
server.xml:
<Service name="Catalina">
<Connector port="18108"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="2000"
maxConnections="50000"
maxThreads="5000"
URIEncoding="utf-8"
minSpareThreads="200"
acceptCount="200"
disableUploadTimeout="false"
enableLookups="false" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="/data/tomcats/ws_18108"
unpackWARs="true" autoDeploy="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
[email protected]