Common java. lang. OutOfMemoryError: unabletocreatenewnativethread Solution
A Brief Introduction to the solutions to similar problems
I encountered this problem when I ran a pressure test on a machine for xxx users. I couldn't even enter xxx.
It indicates that xxx users cannot create multiple threads (of course, the root user does not have this problem)
Maximum Number of threads that the system can create: (MaxProcessMemory-JVMMemory-system memory)/(ThreadStackSize) = Number of threads
There are two methods:
Reduce ThreadStackSize under xxx
Increase the number of nproc under xxx
Modify
[Lsmpusr @ wxlab28bin] $ ulimit-
Core filesize (blocks,-c) 0
Data segsize (kbytes,-d) unlimited
Schedulingpriority (-e) 0
Filesize (blocks,-f) unlimited
Pendingsignals (-I) 256636
Max lockedmemory (kbytes,-l) 64
Max memorysize (kbytes,-m) unlimited
Openfile (-n) 65536
Pipesize (512 bytes,-p) 8
POSIX messagequeues (bytes,-q) 819200
Real-timepriority (-r) 0
Stacksize (kbytes,-s) 10240 ----- reduces this value. We recommend that you reduce it in jvm-xss.
Cputime (seconds,-t) unlimited
Max userprocesses (-u) 1024 ----- You can increase this to 32000
Virtualmemory (kbytes,-v) unlimited
Filelocks (-x) unlimited
Modify/etc/security/limits. conf
* Soft nofile 65536
* Hard nofile 65536
Xxx soft nproc 32000
Xxx hard nproc 32000
Xxx soft stacks 1024
Xxx hard stack 1024