Maximum number of processes for modifying ulimit settings in Linux

Source: Internet
Author: User

When I recently published an application on a Linux server, I encountered the following exception:

Caused by: java.lang.OutOfMemoryError: unable to create new native threadat java.lang.Thread.start0(Native Method)at java.lang.Thread.start(Thread.java:640)

At first glance, it may be thought that the system memory is insufficient. If you think about it like this, you will be taken to the channel with this prompt.
The essence of the above error message is that the Linux operating system cannot create more processes, resulting in errors. To solve this problem, you need to modify Linux to allow more processes to be created.

Modify the maximum number of processes in Linux

You can use ulimit-a to view system parameters of the current Linux system.

$ ulimit -acore file size          (blocks, -c) 0data seg size           (kbytes, -d) unlimitedscheduling priority             (-e) 0file size               (blocks, -f) unlimitedpending signals                 (-i) 62357max locked memory       (kbytes, -l) 64max memory size         (kbytes, -m) unlimitedopen files                      (-n) 65536pipe size            (512 bytes, -p) 8POSIX message queues     (bytes, -q) 819200real-time priority              (-r) 0stack size              (kbytes, -s) 10240cpu time               (seconds, -t) unlimitedmax user processes              (-u) 4096virtual memory          (kbytes, -v) unlimitedfile locks                      (-x) unlimited

Among the above parameters, we usually pay more attention to the maximum number of files that a process can open, that is, open files. The maximum number of processes allowed to be created is the max user processes parameter. We can use ulimit-u 4096 to modify the value of max user processes, but it only takes effect in the session of the current terminal. After logon, the default value is still used.
The correct modification method is to modify the value in the/etc/security/limits. d/90-nproc.conf file. Let's take a look at what this file contains:

$ cat /etc/security/limits.d/90-nproc.conf # Default limit for number of user's processes to prevent# accidental fork bombs.# See rhbz #432903 for reasoning.*          soft    nproc    4096

You only need to modify the value 4096 in the above file.

About the nproc restrictions of ulimit in RHEL6

Linux/Unix ulimit command details

Linux File System limits ulimit usage

Linux certification guide: Linux ulimit command

Linux host uses ulimit to improve system performance

Improve Linux system performance through ulimit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.