简体   繁体   English

Tomcat:连接器的“processingTime”是什么意思?

[英]Tomcat: What's the meaning of a connector's “processingTime”?

What the meaning of Tomcat 6's MBean Catalina:type=GlobalRequestProcessor,name=http-0.0.0.0-8080 for the attribute processingTime ? Tomcat 6的MBean Catalina:type=GlobalRequestProcessor,name=http-0.0.0.0-8080的含义是什么Catalina:type=GlobalRequestProcessor,name=http-0.0.0.0-8080属性processingTime

As far as I understand this, it means the processing time of a specific connector in milliseconds since startup. 据我了解,这意味着自启动以来特定连接器的处理时间(以毫秒为单位)。 But when I measure this value every minute, I occasionally get back values which are much larger than 60k (ie I got delta values up to 1000k). 但是当我每分钟测量这个值时,我偶尔会得到远大于60k的值(即我得到的delta值高达1000k)。

My question is, what milliseconds are measured. 我的问题是,毫秒测量 Real time or CPU time? 实时或CPU时间? Processing time of all connector threads accumulated? 所有连接器线程的处理时间累计?

What would be a good threshold for monitoring the processingTime ? 什么是监控processingTime时间的良好门槛?

Looking at the code, this is cumulative milliseconds of wall clock elapsed time as measured by System.currentTimeMillis() required to process each incoming request. 查看代码,这是由处理每个传入请求所需的System.currentTimeMillis()测量的挂钟经过时间的累积毫秒数。 Thus, this measurement for an individual http connector thread that is always busy (on a system with a stable system clock) shouldn't increment by more than 60,000 per minute. 因此,对于始终忙碌的单个http连接器线程(在具有稳定系统时钟的系统上)的此测量值不应每分钟增加超过60,000。 However, for the GlobalRequestProcessor , it can increase much faster than that depending on how many concurrent requests are being processed. 但是,对于GlobalRequestProcessor ,它可以比这更快地增加,具体取决于正在处理的并发请求数。

If, in a given minute, you receive 100 requests satisfied in one second and another 100 requests that block for 10 seconds before returning a value, then this counter for GlobalRequestProcessor will increase by 100x1x1000 + 100x10x1000 = 1,100,000 in that minute. 如果在给定的一分钟内,您在一秒钟内收到100个满意的请求,并且在返回值之前另外100个请求阻塞10秒,那么GlobalRequestProcessor此计数器将在该分钟内增加100x1x1000 + 100x10x1000 = 1,100,000。

Note that since this measures wall clock elapsed time, if the clock on your server jumps forward, it will cause you to get erroneously large values for the elapsed time. 请注意,由于这会测量挂钟经过的时间,如果服务器上的时钟向前跳跃,则会导致错误地获取经过时间的大值。 That is, if the time jumps forward by one minute during a given servlet's processing and the servlet took 20 seconds to process the request, this measurement will tell you that the servlet took 80 seconds to process the request. 也就是说,如果在给定的servlet处理期间时间向前跳过一分钟并且servlet花了20秒来处理请求,则此测量将告诉您servlet花了80秒来处理请求。 If you happen to have a live request when the DST "Spring Forward" occurs, then you'll be told that that request took over an hour, meaning that this JMX measurement will increment by more than one hour. 如果您在DST“Spring Forward”发生时碰巧有实时请求,那么您将被告知该请求需要一个多小时,这意味着此JMX测量将增加一个多小时。 For the version I looked at, if the clock jumps backwards, you can end up decrementing this counter! 对于我看过的版本,如果时钟向后跳,你可以最终减少这个计数器! Hopefully Tomcat 6 uses System.nanoTime() to avoid this dependence on system clock stability. 希望Tomcat 6使用System.nanoTime()来避免这种对系统时钟稳定性的依赖。

Prior to Java 1.5, there just isn't a good way to measure true elapsed time (as opposed to elapsed wall clock time). 在Java 1.5之前,没有一种很好的方法来测量真实的经过时间(而不是经过的挂钟时间)。 Since none of Tomcat 6.x and earlier require Java 5 or later, there is not really a way for them to measure anything other than milliseconds or to measure a true elapsed time that is independent of clock changes. 由于Tomcat 6.x及更早版本都不需要Java 5或更高版本,因此它们无法测量除毫秒之外的任何其他内容,也无法测量与时钟更改无关的实际经过时间。 (Unless there is use of reflection to do this. I haven't noticed any but I haven't searched for it either.) (除非使用反射来做到这一点。我没有注意到,但我也没有搜索过它。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM