请求时间包括Java中的STW(垃圾收集)时间(Tomcat)。

huangapple go评论72阅读模式
英文:

Resquest time included STW (Garbage Collection) time in Java (Tomcat)

问题

在Catalina JMX中是否有用于度量请求时间的指标,包括垃圾回收时间(如果适用)?

我知道有关垃圾回收时间的指标,但我正在寻找反映JVM内端到端请求时间的指标。

非常感谢。

JVM内端到端请求时间的JMX指标。

英文:

Are there any request time metric in catalina jmx, that account Garbage Collection time (if apply)?

I know the metrics for GC time but i am searching for something that reflects the request time end to end inside JVM.

Thanks a lot.

JMX metric for request time end to end inside JVM.

答案1

得分: 1

在https://tomcat.apache.org/tomcat-8.5-doc/config/http.html中,我读到:

"连接被排队在由Connector创建的服务器套接字中,直到有可用线程来处理连接。一旦达到maxConnections,操作系统将排队进一步的连接。操作系统提供的连接队列的大小可以通过acceptCount属性来控制。如果操作系统队列已满,进一步的连接请求可能会被拒绝或超时。默认值为100。"

以及:

"acceptCount:当达到maxConnections时,用于传入连接请求的操作系统提供的队列的最大长度。操作系统可能会忽略此设置并使用不同大小的队列。当此队列已满时,操作系统可能积极拒绝额外的连接或这些连接可能会超时。默认值为100。"

因此,队列池位于JVM之外,没有与之相关的JMX指标,因此不可能包括停顿时间在内的请求时间指标。

我们可以通过以下命令来监视操作系统中的队列池:

ss -lt sport 10432
State      Recv-Q     Send-Q         Local Address:Port          Peer Address:Port     Process
LISTEN     0          100                        *:10432                    *:*

在上面的示例中,Tomcat正在监听端口10432。有一个100个连接池限制,队列中没有连接。当在Listen状态端口上执行该命令时,Recv-Q和Send-Q反映了队列池中的连接和队列池中的最大连接数。

我执行了以下命令:

while true ;do
ss -lt sport 10432
done

并且当进行全垃圾收集时,队列池会增加,因此非常重要监视垃圾收集花费的时间指标。

谢谢。

英文:

In https://tomcat.apache.org/tomcat-8.5-doc/config/http.html I read:

> "Connections are queued inside the server socket created by the
> Connector until a thread becomes available to process the connection.
> Once maxConnections has been reached the operating system will queue
> further connections. The size of the operating system provided
> connection queue may be controlled by the acceptCount attribute. If
> the operating system queue fills, further connection requests may be
> refused or may time out."

And:

> "acceptCount The maximum length of the operating system provided
> queue for incoming connection requests when maxConnections has been
> reached. The operating system may ignore this setting and use a
> different size for the queue. When this queue is full, the operating
> system may actively refuse additional connections or those connections
> may time out. The default value is 100."

So the queue pool is "outside" JVM and there isn't any JMX metric for it, therefore request time metric that include stop-the-world time is not posible.

What whe can do is to monitor queue pool from the operating system with next command:

ss -lt sport 10432
State      Recv-Q     Send-Q         Local Address:Port          Peer Address:Port     Process
LISTEN     0          100                        *:10432                    *:*

In above example, Tomcat is listening in port 10432. Have a 100 queue connection pool limit and 0 connections in queue. Recv-Q and Send-Q reflects connections in queue pool and Max connections in queue pool respectively when the command is issue in a Listen state port.

I did Next command:

while true ;do
ss -lt sport 10432
done

And queue pool increase when full Garbage Collection take place so it's very important to put an eye in Garbage Collection spent time metric.

Thanks.

huangapple
  • 本文由 发表于 2023年2月10日 02:51:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75403176.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定