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

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

  • 相关阅读:
    WebApi之DOM的基本介绍
    Javascript常见数据类型API
    JavaScript作用域与对象
    Javascript数组与函数初识
    久等了,你要的 Python 书籍推荐,来了
    六种酷炫Python运行进度条
    python获取系统内存占用信息的实例方法
    在图像中隐藏数据:用 Python 来实现图像隐写术
    付费?是不可能的!20行Python代码实现一款永久免费PDF编辑工具
    Python数据分析实战:使用pyecharts进行数据可视化
  • 原文地址:https://www.cnblogs.com/grj001/p/12223591.html
Copyright © 2011-2022 走看看