zoukankan      html  css  js  c++  java
  • tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 8080

    1、INFO: Maximum number of threads (200) created for connector with address null and port 8091

    说明:最大线程数错误

    解决方案:

    使用线程池,用较少的线程处理较多的访问,可以提高tomcat处理请求的能力。使用方式:

    首先。打开/conf/server.xml,增加

    [html] view plain copy
     
     print?
    1. <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"      
    2.         maxThreads="500" minSpareThreads="20" maxIdleTime="60000" />    


    最大线程500(一般服务器足以),最小空闲线程数20,线程最大空闲时间60秒。

    然后,修改<Connector ...>节点,增加executor属性,如:

    [html] view plain copy
     
     print?
    1. <Connector executor="tomcatThreadPool"      
    2.                port="80" protocol="HTTP/1.1"      
    3.                connectionTimeout="60000"    
    4.                keepAliveTimeout="15000"    
    5.                maxKeepAliveRequests="1"    
    6.                redirectPort="443"    
    7.                ....../>    


    2、java.net.SocketException: Too many open files

    当tomcat并发用户量大的时候,单个jvm进程确实可能打开过多的文件句柄。

    使用 #lsof -p 10001|wc -l   查看文件操作数

    如下操作:

    [html] view plain copy
     
     print?
      1. (1).ps -ef |grep tomcat  查看tomcat的进程ID,记录ID号,假设进程ID为10001     
      2. (2).lsof -p 10001|wc -l    查看当前进程id为10001的 文件操作数     
      3. (3).使用命令:ulimit -a   查看每个用户允许打开的最大文件数     
      4.   默认是1024.     
      5. (4).然后执行:ulimit -n 65536 将允许的最大文件数调整为65536   
  • 相关阅读:
    设计模式(二十)---迭代器模式
    设计模式(十九)---观察者模式
    设计模式(十八)---模板方法模式
    设计模式(十七)---策略模式
    ElasticSearch 安装
    MongoDB进击 Linux单机安装
    List集合去除重复对象。。。记录一下
    Springboot整合mybatisPlus实现分页
    git记录
    Springboot异常处理errorController
  • 原文地址:https://www.cnblogs.com/swite/p/5730482.html
Copyright © 2011-2022 走看看