ulimit -a Used to display current user process limits. For each user, Linux limits the maximum number of processes. In order to improve performance, you can set the maximum number of processes for each linux user according to the device resources. Below I set the maximum number of processes for a linux user to 10000: ulimit -u 10000 for many socket connections and open them. For Java applications, it is best to modify the number of files that can be opened per process by using ulimit -n xx. The default value is 1024. Ulimit -n 4096 Increases the number of files that can be opened per process to 4096. The default is 1024. Other 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 unlimitedCPU Time: ulimit -t unlimited virtual memory: ulimit -v unlimited
Temporarily, for logging in to a shell session with the ulimit command. Permanently, by adding a corresponding ulimit statement to the file read by the login shell, that is, a shell-specific user resource file, such as:
1), releasing the maximum number of processes and maximization of the Linux system File open limit: vi /etc/security/limits.conf# Add the following line * soft noproc 11000* hard noproc 11000* soft nofile 4100* hard nofile 4100
Description: * stands for noproc for all users Represents the maximum number of processes, nofile, which represents the maximum number of open files. 2) Let SSH accept the login of the Login program. It is convenient to view the ulimit -a resource limit on the ssh client: a, vi /etc/ssh/sshd_config changes the value of UserLogin to yes , and remove the # comment, restart the sshd service: /etc/init.d/sshd restart3), modify the environment variable file of all linux users: vi /etc/profileulimit -u 10000ulimit -n 4096ulimit -d unlimitedulimit -m unlimitedulimit - s unlimitedulimit -t unlimitedulimit -v unlimited
/*********************************** ***
Sometimes you need to open multiple files in the program for analysis. The system usually the default number is 1024 (you can see with ulimit -a) is enough for normal use, but for the program is concerned, it is too little.
Modify 2 files. 1./etc/security/limits.confvi /etc/security/limits.conf plus: * soft nofile 8192* hard nofile 204802./etc/pam.d/loginsession required /lib/security/pam_limits.so*** ******* Also make sure that the /etc/pam.d/system-auth file has the following content required /lib/security/$ISA/pam_limits.so line to ensure that the system will enforce this restriction. ***********3. The general user's .bash_profile#ulimit -n 1024 re-login ok————-for solaris
In fact, there is such a command in the system Ulimit, the following is the result of ulimit -a execution:
time(seconds) unlimitedfile(blocks) unlimiteddata(kbytes) unlimitedstack(kbytes) 8192coredump(blocks) unlimitednofiles(descriptors) 1024memory(kbytes) unlimited where nofiles is the file The variable value of the descriptor, which is affected by the rlim_fd_cur parameter, which can be modified with the ulimit -n number command. But no matter how you change it, the program still can't break the limit of fd=256. The following information can be found in the Solaris Tunable Parameters Reference Manua book:
A 32-bit program using standard I/O is limited to 256 file descriptors. A 64-bit program using standard I/O can use up to 2 billion descriptors. This means that 32-bit programs can't break through this limitation. Only 64-bit programs can use up to 200 million file descriptors. SUN's hardware and software have realized 64-bit architecture long ago. The solution is to compile the program into a 64-bit program. In order to generate a 64-bit program, you must have a 64-bit compiler (in fact, this is not the case). If you go to www.sunfreeware.com to download the 64-bit compiler gcc, on the website. Not specifically noted is the 64-bit gcc, but there will be an unexpected gain, that is, the description of the software indicates that you can generate a 64-bit program by adding the -m64 option when compiling with gcc.
So after using gcc-m64 to compile and generate a 64-bit program, use ulimit -n 102400 to set the number of fd to a large size, all the problems are solved, and there is no longer enough file descriptors. Case.
Set the rlimi_fc_max and rlim_fd_cur formats in the /etc/system file as follows:
* set hard limit on file descriptorsset rlim_fd_max = 4096* set soft limit on file descriptorsset rlim_fd_cur = 1024 command ulimit uses the following format :
usage: ulimit [ -HSacdfnstv ] [ limit ]ulimit -a is to display the setting value of each parameter, ulimit -n is used to set the maximum value of fd. *************************************************< Br>
Modify File Descriptor Limits
Solaris has two parameter control file descriptors that can be opened by the process: rlim_fd_max, rlim_fd_cur. The former modification is a hard setting, the modification requires permission, and the latter is a soft setting. The user can modify it by limit or setrlimit(), and the maximum value cannot exceed the former. Generally we modify these two parameters in /etc/system
set rlim_fd_max = 65535
set rlim_fd_cur = 65535
=========== ===============
ulimit The resource used by the shell to start the process.
You can use this command to check the status of resources occupied by the process.
Usage: ulimit [-acdfHlmnpsStvw] [size]
-H Set hardware resource limit.-S Set software resource limit.-a Display all current resource limits.-c size: Set the maximum value of the core file. Unit: blocks-d size: set the maximum value of the data segment. Unit: kbytes-f size: set the maximum value of the created file. Unit: blocks-l size: set the maximum locking process in memory Value. Unit: kbytes-m size: Set the maximum value of resident memory that can be used. Unit: kbytes-n size: Set the maximum value of the file descriptor that the kernel can open at the same time. Unit: np size: Set the pipe buffer Maximum value. Unit: kbytes-s size: Set the maximum value of the stack. Unit: kbytes-t size: Set the maximum upper limit of CPU usage. Unit: seconds-v size: Set the maximum value of virtual memory. Unit: kbytes 51] In the RH8 environment file /etc/profile, we can see how the system configures ulimit:
#grep ulimit /etc/profileulimit -S -c 0 > /dev/null 2>& 1 (output redirection, normal output and exception output are ignored)
This statement sets the software resource and the core text. Size setting 2] If we want to limit the size of the file created by the shell, such as:
#ll h-rw-r–r– 1 lee lee 150062 July 22 02:39 h #ulimit -f 100 #Set the largest block of created files (one block = 512 bytes) #cat h>newhFile size limit exceeded#ll newh-rw-r–r– 1 lee lee 51200 November 8 11:47 newh file h The size is 15062 bytes, and the size of the created file we set is 512 bytes x 100 blocks = 51200 bytes. Of course, the system will generate 51200 bytes of newh files according to your settings. 3] Can be like example 1] Similarly, put the ulimit you want to set in the /etc/profile environment file. If set for all users, set it in /etc/security/limits.conf.
For beginners, the learning of Linux commands is not so simple. Many beginners rarely use commands o
After linux rm deletes the file, recovery is more troublesome. Even if it is restored, the file na
self-entertainment, I decided to start a Linux server, then execute the ld & ldquo;rm –rf /&rd
Engaged in two years WindowsClient development, what multi-threading, multi-process development, ha
Shorewall firewall installation and configuration method under Linux
CentOS installed essential - basic settings and missing files
How to reset MySQL ROOT password under Linux
Linux port scanning tool nmap use basic tutorial
Ubuntu format U disk method (based on formatting commands)
Linux newbie tutorial: teach you how to mount the hard disk
Linux under the lack of boot space solution
Win7 boom will continue until 2013
Problems with installing small input methods under centos
How to install a configuration firewall on Win2000
Windows7 is out of stock There are still software compatibility issues
Security talk: not a versatile firewall has loopholes
Win10 Mobile Preview 10581 Download Card at 0% Solution
Win7 full screen to see the black border of the video frame how to do
How to use WeChat to quickly add friends to WeChat
Windows7 system using Youku player to appear white screen how to do
Win7 system browser open web page garbled solution
After Windows7 starts, the network icon keeps turning around.
How to change the district of Win10 store? Win store modified area tutorial