zoukankan      html  css  js  c++  java
  • [tomcat调优]Tomcat7中maxThreads等于1问题

    [tomcat调优]Tomcat7中maxThreads等于-1问题

    2018-04-29 17:54:55  阅读数 2083更多

    分类专栏: 错误解决方案

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

    本文链接:https://blog.csdn.net/weixin_38278878/article/details/80144397

    今天给服务器上的Tomcat进行调优,配置如下:

    <span style="color:#000000"><code><span style="color:#006666 !important"><<span style="color:#4f4f4f !important">Executor</span> <span style="color:#4f4f4f !important">name</span>=<span style="color:#009900 !important">"tomcatThreadPool"</span> <span style="color:#4f4f4f !important">namePrefix</span>=<span style="color:#009900 !important">"catalina-exec-"</span>
       <span style="color:#4f4f4f !important">maxThreads</span>=<span style="color:#009900 !important">"500"</span>  <span style="color:#4f4f4f !important">minSpareThreads</span>=<span style="color:#009900 !important">"5"</span>  /></span>
    
    
    <span style="color:#006666 !important"><<span style="color:#4f4f4f !important">Connector</span> <span style="color:#4f4f4f !important">executor</span>=<span style="color:#009900 !important">"tomcatThreadPool"</span> <span style="color:#4f4f4f !important">port</span>=<span style="color:#009900 !important">"8080"</span>              
        <span style="color:#4f4f4f !important">protocol</span>=<span style="color:#009900 !important">"org.apache.coyote.http11.Http11NioProtocol"</span>
        <span style="color:#4f4f4f !important">connectionTimeout</span>=<span style="color:#009900 !important">"20000"</span> <span style="color:#4f4f4f !important">redirectPort</span>=<span style="color:#009900 !important">"8443"</span> /></span></code></span>

    将线程池可以容纳的最大线程数设为500,最小不活跃线程数设为5

    结果如下: 
    这里写图片描述

    最小线程数设置成功,最大线程数为-1;之后将maxThreads改成了默认值200,1000等等,都是显示-1; 
    难道这个属性失效了吗?

    经过测试,这个属性是生效的,将其设为1后,Current thread count(当前线程数)是不会超过1的。

    但为什么会显示-1呢? 查了tomcat7文档的maxThreads属性: 
    这里写图片描述

    最后一句话“Note that if an executor is configured any value set for this attribute will be recorded correctly but it will be reported (e.g. via JMX) as -1 to make clear that it is not used.”就说到了这个情况,意思大概是: 
    如果配置了一个Executor,则该属性的任何值集将被正确记录,但是它将被显示为-1

    折腾了一个多小时,终于真相大白。

  • 相关阅读:
    完美解决IE8有两个进程的问题
    用ccproxy + stunnel做个加密代理
    Hyper-V 共享式网络链接 端口映射
    NET Framework 4.0的安装失败处理
    c#控制IE浏览器自动点击等事件WebBrowser,mshtml.IHTMLDocument2 .
    设置IE8 多个Table只产生一个进程
    SSH Secure Shell Client中文乱码的解决办法
    OOD设计模式
    MVC设计模式
    乐观锁和悲观锁
  • 原文地址:https://www.cnblogs.com/grj001/p/12223590.html
Copyright © 2011-2022 走看看