1

apache2 worker.properties:

worker.node223.connection_pool_size=100
worker.node223.connection_pool_minsize=50

tomcat server.xml:

<Connector address="192.168.0.17" port="8009" maxHttpHeaderSize="64836"
           maxThreads="350" minSpareThreads="50" maxSpareThreads="200"
           acceptCount="700" connectionTimeout="360000" disableUploadTimeout="true"
           enableLookups="false" URIEncoding="UTF-8" protocol="AJP/1.3" />

connection_pool_size 应该意味着应该建立到后端服务器(tomcat)的最大 tcp 连接数。当我为 tomcat 服务器运行 kill -3 时。如下:

........      
"TP-Processor499" daemon prio=10 tid=0x00007fb8455b5000 nid=0x4521 in Object.wait() [0x00007fb7ffe3f000]
       java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00007fb89017d430> (a org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
        at java.lang.Object.wait(Object.java:485)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)
        - locked <0x00007fb89017d430> (a org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
        at java.lang.Thread.run(Thread.java:619)


"TP-Processor498" daemon prio=10 tid=0x00007fb8455b3000 nid=0x4520 runnable [0x00007fb7fff40000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    - locked <0x00007fb8a486fde0> (a java.io.BufferedInputStream)
    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:559)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
    at java.lang.Thread.run(Thread.java:619)

...........

然后我得到:

TP-Processor 有 295 个,我猜 295< connection_pool_size+maxSpareThreads = 300; 295 < maxThreads = 350,没关系。

有 189 个 Tp 处理器(在 WAITING 中)< maxSpareThreads = 200,没关系。

有 106 个 TP 处理器(在 RUNNABLE 中)> connection_pool_size = 100,我认为这是错误的。

难道我做错了什么?如果没有,您知道对此的可能解释吗?谢谢

4

1 回答 1

1

如果我没看错,那么 100 是每个工人的最大线程数。也许有不止一名工人在运行。

http://tomcat.apache.org/connectors-doc/reference/workers.html
于 2011-11-02T21:43:03.647 回答