How can I limit the maximum number of processes and maximum file handle opening in Linux?

Source: Internet
Author: User

This article shares with you the main Linux the maximum number of processes and the maximum file handle opening limit is lifted related content, come together to look at it, hope to everyone Learning Linux helpful.

Ulimit Resources used by the shell startup process

1. Syntax format:

ulimit [-ACDFHLMNPSSTVW] [size]

2, Parameter introduction :

-H Sets the hardware resource limit .

-S sets the software resource limit .

-a displays all current resource limits .

-C size : Sets The maximum value of the core file . Unit : Blocks

-D Size: sets the maximum value for the data segment . Unit : Kbytes

-F Size: Sets the maximum value for the created file . Unit : Blocks

-L Size: sets the maximum value of the locked process in memory . Unit : Kbytes

-M Size: Sets the maximum number of resident memory that can be used . Unit : Kbytes

-N Size: Sets the maximum number of file descriptors that the kernel can open at the same time . Unit : N

-P Size: sets the maximum value of the pipe buffer . Unit : Kbytes

-S Size: sets the maximum value of the stack . Unit : Kbytes

-T size : Sets the maximum limit for CPU usage time . Unit : Seconds

-V Size: Sets the maximum value for virtual memory . Unit : Kbytes

-u number: Set user max Processes (max user processes)

3. Linux for each user, the system limits its maximum number of processes. To improve performance, you can set the maximum number of processes per Linux user according to the device resource situation, I set the maximum number of processes for a Linux user to 10000 :

Ulimit-u 10000

4. For Java applications thatneed to do many socket connections and leave them open , it is best to use ulimit-n xx Modifies the number of files that each process can open, with a default value of 1024x768. Increase the number of files that each process can open to 4096, which defaults to 1024x768.

Ulimit-n 4096

5.some important settings that are set to Unlimited (unlimited) are:

Data segment Length:ulimit-d Unlimited

Maximum memory size:ulimit-m Unlimited

stack size:ulimit-s Unlimited

CPU time:Ulimit-t Unlimited

virtual Memory:Ulimit-v Unlimited

6. the maximum number of processes and maximum file opening limits of the Linux system are lifted :

1)vi/etc/security/limits.conf, add the following line

* Soft noproc 65535 * hard noproc 65535 * Soft nofile 65535 * hard nofile 65535

Description:* represents for all users

Noproc represents the maximum number of processes

Nofile is the number of open files representing the maximum file

2), modify the environment variable files for all Linux users:

Shell> vi /etc/ profile

Add the following configuration on the last side:

Ulimit-u 65535 ulimit-n 65535ulimit-d Unlimited ulimit-m unlimited ulimit-s unlimited ulimit-t unlimited ulimit-v u nlimited

Effect:

Shell> source /etc/ profile

Source: Linux commune

How do I remove the maximum number of processes and maximum file handle opening limits in Linux?

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.