You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "tanming1003@163.com" <ta...@163.com> on 2016/06/21 13:04:41 UTC

Tomcat 7 performance tuning take full advantage of hardware

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 &quot;%r&quot; %s %b" />
   
        </Host>
      </Engine>
    </Service>
  </Server>





tanming1003@163.com

Re: Tomcat 7 performance tuning take full advantage of hardware

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tanming,

On 6/21/16 9:04 AM, tanming1003@163.com wrote:
> 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?

What makes you think that the CPU should be higher than 20%?

What does your test load profile look like?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJXbVpTAAoJEBzwKT+lPKRYcM0P/R7J7aCIcIY5cCuPjrRQRPk7
ZeGcUmEbEr+5MxXC4jYFSqZuxthpWjta/kICmTPAMF/n6YB3206SHBSUOWVitCqX
FxlaPCmhkoZ+9nyeEhlRTr3y6HrqfZBpYmQZMac8FSFV22Expq/k0vUhGqPKsmjy
g8eQiA8e8L7BxEDHS5CAPawvsSNog6ZrBi2Gdjo69C17QubM0lsbNKZ7NNNwmsDE
pSiaTa0lCL6xxUkd+un74JhPKxHBDPNdw+Zr7sEWky6K5ophcJUf4Ch2Q+TX8Hgr
EiHMnknqAi7vI5zkhnC3AgMEt+9hurMqnBTZ8B4CTq/JtB4YP72AchN3aUSGoIFy
zXolRZSR3SqmhxNTCLVegNNTF502DRCvALa+ZjZ+9SfQAPF3UDrcvnm4MZ+4btIz
gekP3hGRq2v9Z5m4KgwQpFHyRF6ncRos3e3+bn7OgYi6U3SyY+UO+2PVsXurrUy6
YtMIugERc79z8d8zh1pXCznT6TCE/ePakWqL/hImZce3wP+9InlLilgbcK68D5W2
7zY82wj1nig6GinUjYeQMf/LzC2AYKotza/gYFx8Fv896OkjlTaG/Zvy1E2ZJubK
jwYmRjMVEd7tvQBuJjuKOlVnCv7TMAAvNOVkZxIvld4GbhJZJUmJg2X4g0ticIT0
ywmiAvvoMjp7Ugj9Irs3
=wHy7
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org