JavaMelody和Ab中的tomcat性能监视 [英] tomcat performance monitoring in JavaMelody and ab

查看:119
本文介绍了JavaMelody和Ab中的tomcat性能监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JavaMelody和基准测试的新手.我使用 JavaMelody 来监视

I am new to JavaMelody and benchmark. I am using JavaMelody to monitor my Jersey Application in tomcat following https://dzone.com/articles/a-step-by-step-guide-to-tomcat-performance-monitor.

我的应用程序设置: 由docker-compose设置的4个docker容器:myapplication(tomcat,jersey应用程序),kafka,postgres,zookeeper.

My application setup: 4 docker containers setup by docker-compose: myapplication (tomcat, jersey application), kafka, postgres, zookeeper.

我从javaMelody监视页面获得了以下详细信息:

I got the following details from javaMelody monitoring page:

Host:   16a180e86bba@172.18.0.5
Java memory used:   784 Mb / 7,124 Mb       ++++++++++++
Nb of http sessions:    0   
Nb of active threads
(current http requests):    9   
Nb of active jdbc connections:  0   
Nb of used jdbc connections
(opened if no datasource):  0
System load 27.89   
% System CPU    93.36       ++++++++++++

##############
# Details
##############

OS:     OS Linux, 4.11.0-32-generic , amd64/64 (8 cores)
Java:   OpenJDK Runtime Environment, 1.8.0
JVM:    OpenJDK 64-Bit Server VM
PID of process:     1
Nb of opened files  418 / 1,048,576    ++++++++++++
Server:     Server Apache Tomcat/8.0.50
Webapp context:     /event-bus
Start:  2/28/18 2:47 PM
JVM arguments:  -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djdk.tls.ephemeralDHKeySize=2048
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
-Dignore.endorsed.dirs=
-Dcatalina.base=/usr/local/tomcat
-Dcatalina.home=/usr/local/tomcat
-Djava.io.tmpdir=/usr/local/tomcat/temp
Mean age of http sessions (min):    -1
Tomcat "http-apr-8080":     Busy threads = 17 / 200     ++++++++++++
Bytes received = 65,071,259
Bytes sent = 4,411,314
Request count = 538,335
Error count = 19,253
Sum of processing times (ms) = 17,998,558
Max processing time (ms) = 3,161
Memory:     Non heap memory = 99 Mb (Perm Gen, Code Cache),
Buffered memory = 33 Mb,
Loaded classes = 9,535,
Garbage collection time = 1,420 ms,
Process cpu time = 854,410 ms,
Committed virtual memory = 14,718 Mb,
Free physical memory = 21,865 Mb,
Total physical memory = 32,052 Mb,
Free swap space = 32,651 Mb,
Total swap space = 32,651 Mb
Free disk space:    408,262 Mb
Dependencies:   Dependencies Dependencies     View Maven's pom View Maven's pom
Threads Threads
Threads on 16a180e86bba@172.18.0.5: Number = 624, Maximum = 681, Total started = 1,182

我有一些问题:

1,我设置了4个docker容器,tomcat正在其中一个容器中运行. JavaMelody能否在我的应用程序或仅是Docker容器的CPU和内存使用量上给出准确的结果?

1, I setup 4 docker containers and tomcat is running in one of them. Does JavaMelody give out accurate result on CPU and memory usage of my application or just docker containers?

2,我的计算机中有8个内核,% System CPU 93.36是否表示m y个应用使用了全部8个内核CPU资源的 93.36%? 我使用docker stats <docker id>并得到我的应用程序的CPU %约为336%.我很困惑.

2, There are 8 cores in my machine, does % System CPU 93.36 mean my application used 93.36% of all 8 cores CPU resource? I used docker stats <docker id> and got CPU % of my application is about 336%. I am confused.

3,system load是什么意思?

4,7124 MbJava memory used: 784 Mb / 7,124 Mb ++++++++++++中是什么意思?

4, what does 7124 Mb mean in Java memory used: 784 Mb / 7,124 Mb ++++++++++++?

5,在Tomcat "http-apr-8080": Busy threads = 17 / 200 ++++++++++++Threads on 16a180e86bba@172.18.0.5: Number = 624, Maximum = 681, Total started = 1,182中.

17/200表示接受连接的最大线程数是200,但仅使用了17个.但是Number = 624, Maximum = 681, Total started = 1,182是什么意思?

Does 17/200 mean the maximum number of threads to accept connections is 200, but only 17 are used. but what does Number = 624, Maximum = 681, Total started = 1,182 mean?

6,我使用 ab 在200中发送了20000个请求并发.但是为什么只使用17/200?如何制作200/200?

6, I used ab to send 20000 requests in 200 concurrency. But why only 17/200 used? How to make 200/200?

7,从ab的报告中,我发现有1.3%的请求失败.这是否意味着我在AB测试中设置了太多的并发性?还是这意味着tomcat无法处理所有请求(但tomcat仅使用17/200)?

7, from report of ab, I found 1.3% failed requests. Does this mean I setup too many concurrency in ab test? Or does this mean tomcat cannot handle all requestion (but only 17/200 used in tomcat)?

谢谢.

推荐答案

  1. 两者:适用于应用程序和操作系统
  2. 系统CPU是操作系统的%CPU.最后一分钟,所有内核的93%为93%(最大值为100%). 336%可能仅在最后几秒钟.
  3. 系统负载是指操作系统的平均负载.
  4. 这表示堆的最大大小(如Xmx).
  5. 是的,这意味着http线程的最大数量为200,但仅使用了17个.但是,一般来说,对于具有8个内核的应用程序,已经使用的17个http线程已经很高. Theads on ...: Number = 624, Maximum = 681, Total started = 1,182表示有624个线程处于活动状态,有681个线程在一段时间之前处于活动状态,自启动Tomcat以来已启动1182个线程
  6. 我怀疑您是否可以同时使用200个使用的线程和8个内核.可能没有足够的核心.一般来说,要使200个线程处于活动状态而不等待数据库或其他东西,理论上您将需要200个内核.在您的情况下,或者您的服务器足够快,可以发送比ab抛出的响应更快的速度,或者ab和线程之间还有其他事情减慢了线程分配的速度(我认为cpu的93%可能是造成这种情况的原因).
  7. CPU似乎已饱和,并且200 ab线程可能太多,因此出现一些故障是正常的.
  1. Both: for the application and for the operating system
  2. System CPU is the %CPU for the OS. And 93% is 93% of all cores for the last minute (100% is the maximum). 336% is probably for the last seconds only.
  3. System load means the load average of the OS.
  4. It means the maximum size of the heap (like in Xmx).
  5. Yes, it means that the max of http threads is 200, but only 17 are used. But 17 used http threads is quite high already for an application with 8 cores, generally speaking. Theads on ...: Number = 624, Maximum = 681, Total started = 1,182 means 624 threads are live, 681 were alive at the maximum some time ago, 1182 threads were started since starting Tomcat
  6. I doubt that you can have 200 used threads concurrently with 8 cores. There is probably not enough cores for that. Generally speaking, to have 200 threads active and not waiting for the database or something else, you would need theoretically 200 cores. In your case, either your server is fast enough to send responses faster than ab can throw at it or there is something else between ab and the threads which slows threads allocations (I think that cpu at 93% may be the cause of that).
  7. CPU seems saturated and 200 ab threads is probably too much so it is normal to have some failures.

这篇关于JavaMelody和Ab中的tomcat性能监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆