jvm到底能运行多少个线程
所属分类 jvm
浏览量 938
影响因素
jvm配置 -Xms -Xmx -Xss
-Xss
the stack size for each thread
-Xmx1024m -Xms1024m -Xss128k
jcmd 15611 VM.flags -all
intx ThreadStackSize = 1024 {pd product}
系统限制
max_user_process(ulimit -u)
/proc/sys/kernel/pid_max
/proc/sys/kernel/thread-max
/proc/sys/vm/max_map_count
cat /proc/sys/kernel/pid_max
32768 (32K)
ulimit -u
7282
cat /proc/sys/vm/max_map_count
65530
cat /proc/sys/kernel/thread-max
cat: /proc/sys/kernel/thread-max: 没有那个文件或目录
MaxThreadCountTest
https://gitee.com/dyyx/hellocode/blob/master/src/MaxThreadCountTest.java
java MaxThreadCountTest
java.lang.OutOfMemoryError: unable to create new native thread
java -Xss128k MaxThreadCountTest
The stack size specified is too small, Specify at least 228k
java -Xss256k MaxThreadCountTest
java MaxThreadCountTest
java.lang.OutOfMemoryError: unable to create new native thread
8005
ulimit -u
10000
ulimit -u 60000
-bash: ulimit: max user processes: 无法修改 limit 值: 不允许的操作
sudo ulimit -n 65535
sudo: ulimit: command not found
用以下方式修改 !!!
sudo sh -c "ulimit -u 60000 && exec su $LOGNAME"
ulimit is a shell builtin like cd, not a separate program.
sudo looks for a binary to run, but there is no ulimit binary, which is why you get the error message.
You need to run it in a shell.
/opt/jdk1.8.0_171/bin/java MaxThreadCountTest
java.lang.OutOfMemoryError: unable to create new native thread
63541
jvm参数查看
Linux常用优化设置
上一篇
下一篇
linux mpstat 命令
linux iostat 命令
linux sysstat
aerospike数据删除机制
网络IO模型
G1调优建议