websocket最大数量的限制问题

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址:RuoYi-Nbcio后台管理系统 http://218.75.87.38:9666/

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://218.75.87.38:9888

1、可以修改tomcat的server.xml里的最大线程数为1000(默认是200),如下:

java 复制代码
<!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="9666" protocol="HTTP/1.1"
               connectionTimeout="60000"
               maxTreads="1000"
               minSpareThreads="100"
               maxSpareThreads="1000"
               acceptCount="200"
               maxProcessors="100"
               minProcessors="30"
               redirectPort="18443"
               executor="tomcatThreadPool"
               enableLookups="false"
               useSendfile="false"
               compression="on"
               compressionMinSize="512"
               noCompressionUserAgents="gozilla, traviata"
               compressableMimeType="text/html,text/xml,text/javascript,application/javascript,text/css,text/plain,text/json,application/x-font-woff,image/jpg,image/png,image/gif,audio/x-wav" />
    <!-- A "Connector" using the shared thread pool-->
    <!--

2、修改max locked memory,如下

java 复制代码
[root@localhost nbcio-boot]# ulimit -a 
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63450
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 63450
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[root@localhost nbcio-boot]# 

max locked memory (kbytes, -l) 64 这个太低了,需要修改

ulimit相关修改参数如下

可以临时修改这个参数(重启后无效了)

ulimit -l 102400

修改好后显示如下:

java 复制代码
[root@localhost nbcio-boot]# ulimit -l 102400
[root@localhost nbcio-boot]# ulimit -a 
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63450
max locked memory       (kbytes, -l) 102400
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 63450
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[root@localhost nbcio-boot]# 

vi /etc/security/limits.conf 永久修改这个参数,增加下面参数

java 复制代码
* soft nofile 65536
* hard nofile 65536
* soft memlock 102400
* hard memlock 102400
相关推荐
Byron Loong35 分钟前
【网络】Python 怎么做TCP通讯
网络·python·tcp/ip
Whitemeen太白38 分钟前
查询子级分类、父级分类、叶子节点分类(MySQL / Oracle )
数据库·mysql·oracle
裕工实验室1 小时前
功率模块为什么一定要用陶瓷PCB?从结构到选材一篇讲清(附DPC / DBC / AMB选型逻辑)
网络·硬件工程·pcb工艺·材料工程
SilentSamsara1 小时前
HTTP/1.1 到 HTTP/3:每代协议解决了什么问题
网络·网络协议·tcp/ip·http·https
一只游鱼2 小时前
langchain4j+mysql+历史记录
mysql·langchain4j
Flash.kkl2 小时前
传输层UDP、TCP
网络协议·tcp/ip·udp
空中海2 小时前
第七章:iOS网络与数据持久化
网络·ios
不爱写程序的东方不败2 小时前
MySQL出现慢查询或者主从延迟的问题,怎么做根因分析?
数据库·mysql
努力努力再努力wz3 小时前
【MySQL入门系列】掌握表数据的 CRUD:DML 核心语法与执行逻辑解析
android·开发语言·数据结构·数据库·c++·b树·mysql
сокол3 小时前
【网安-等保评测-基础记录】网络安全等级保护2.0 详解(定级、备案、测评、整改一站式指南)
网络·笔记·网络安全·云计算