linux maximum number of open files and swap limit

linux maximum number of open files and swap limit

 
Alex Hee  
2017.07.24 15:39 *  word 388  read 314 comments 0

The core linux 2.6+ will use a portion of the hard disk as a SWAP partition, used for process scheduling - the process is a running program - not the current process into a 'wait (standby)', or even 'sleep (sleep) 'Once you do, then tune into' activity (active) ', the process will lay sleeping SWAP partitions to sleep, the memory space to give out' activities' process.
  If the memory is large enough, it should tell linux do not have to use too much SWAP partition, you can change the value of swappiness. swappiness = 0 indicates when the maximum physical memory and swap space is, swappiness = 100 indicates when an active use of swap area, and the timely data transfer memory to the swap space on the inside.
  In ubuntu inside, swappiness default setting value is equal to 60.

Check swap usage

cat /proc/sys/vm/swappiness

Temporary modification

sudo sysctl vm.swappiness=10

or

echo 10 > /proc/sys/vm/swappiness 

But this is only temporary changes, after you reboot the system will restore the default 60, for the long-term stability, which goes further:

sudo gedit /etc/sysctl.conf

Add a line at the end of this document:

vm.swappiness=10

The maximum number of file viewing system allows open

cat /proc/sys/fs/file-max

Maximum number of files each user is allowed to view open

ulimit -a

The default is found open files (-n) 1024, problems arise here.
Modify the quantitative restrictions in the system file /etc/security/limits.conf, add the contents of the file:

* soft nofile 102400 
* hard nofile 102400

Way to modify the configuration file will need to restart to take effect.

Guess you like

Origin www.cnblogs.com/xuanbjut/p/11479797.html