Recent tests require a long connection to the server. These data need to reach 100W long connection, test client. A thread to keep the connection. Find Linuxserver Creator By default 3200 when multiple threads. This error will get "java.lang.OutOfMemoryError:unable to create new native thread. And, at this time the whole system can not innovate new threads, can not connect the terminal, can not run no matter what command.
It seems that there is not enough memory. But there is still a surplus of real memory. Proven. Some kernel parameters for Linux limit the creation of new threads.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbwljbhvuzw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
Because you want to keep a long connection. Change all first the client guarantees greater allocation of port range changes/etc/sysctl.conf joins such a line: Net.ipv4.ip_local_port_range = 1024 61000
Change the system's number of parameters
echo " 100000 " >/proc/sys/kernel/threads-max |
echo " 100000 " >/proc/sys/kernel/pid_max (default 32768) |
echo "200000" >/proc/sys/vm/max_map_count (Default 65530) |
Change/etc/security/limits.conf* -Nproc 999999
* -Nofile 999999
Ps:nproc is the size of the max user processes that changes the system; Nofile is the size of the open files. In addition, the Linux 2.6.25 kernel has a macro definition that defines the maximum value for this value, which is 1024*1024, which is exactly 1 million, and after the 2.6.25 kernel and beyond. This value can be set by/proc/sys/fs/nr_open, except that 999999 is sufficient.
Very many people may come across. Just to start more than 32,000 threads can no longer be a lot of other threads, in fact, Pid_max = 32768 is limited to
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
How many threads can be created by the JVM: Unable to create new native thread