67. Use of ulimit

Source: Internet
Author: User

1,Ulimit

Set or get the shells resource usage limits

Ulimit [Options] [limit]

2,Option

①-A displays all current resource limits.

②-C size: SetCoreThe maximum value of the file. Unit: Blocks

③-N size specifies the maximum number of files that can be opened at the same time

④-L size: set the maximum value of the locked process in the memory. Unit: KB

⑤-M size: set the maximum value of resident memory that can be used. Unit: KB

⑥-S size: set the maximum value of the stack. Unit: Kbytes

7.-T size: SetCPUThe maximum usage time. Unit: Seconds

Bytes-V Size: sets the maximum value of virtual memory. Unit: Kbytes

3. Example

1) ulimit-s 262140 // set the maximum value of the stack to 256 m , the default value is 10 m

Pass/Etc/profileOr/. Bash_profileTo make the system remember this value.

Source/root/. bash_profile

/Etc/security/limits defines these values

2)Ulimit-u 10000 //Maximum number of processes of a user

3)Ulimit-N 4096 //Set the number of files that each process can open4096

4) it is recommended to set other settings 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

⑥Core File SizeUlimit-C unlimited/size

Note:

file cat /proc/sys/kernel/core_pattern/ record the current core file location, core the current directory.

5) PassUlimitYou can restrict the resources of processes and users respectively. Many applications need to impose a general limit on the resource usage of the entire system. At this time, we need to modify/Proc.

/ProcThe directory contains many parameters in the current state of the system, such/Proc/sys/kernel/pid_max.

4,CLanguageUlimit,Get and set user limits.[5]

Reference

【1]Http://linux.die.net/man/1/ulimit

【2] More parameter descriptions

Http://linux.die.net/man/1/ulimit

Http://zhangyafeng0917.blog.163.com/blog/static/44436412201082921948750/

【3] Explains several application scenarios

Http://www.justwinit.cn/post/2650/

【4] Cited many Application Instances

Http://hi.baidu.com/fengjian1585/blog/item/b49aa7a232f1f1b9cbefd023.html

[ 5 ] http://linux.die.net/man/3/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.