cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:kernel:sysctl.html



linux#kernle

Kernel Parameter in Linux

Check Kernel Parameters

# sysctl -a
sunrpc.tcp_slot_table_entries = 16
sunrpc.udp_slot_table_entries = 16
sunrpc.max_resvport = 1023
sunrpc.min_resvport = 665
sunrpc.nlm_debug = 0
sunrpc.nfsd_debug = 0
sunrpc.nfs_debug = 0
sunrpc.rpc_debug = 0
mc.check_pci_parity = 0
mc.panic_on_pci_parity = 0
mc.poll_msec = 1000
mc.log_ce = 1


How to change Kernel Parameter

temporary

echo 65536 > /proc/sys/fs/file-max
sysctl -w fs.file-max=65536

Permanence

/etc/sysctl.conf

#vi /etc/sysctl.conf
kernel.msgmni=512
vm.swappiness=0

# sysctl -p        <- reflect


Parameter Lists

Keepalive

Parameter Value Note
net.ipv4.tcp_keepalive_intvl 75 ← default
2
net.ipv4.tcp_keepalive_time 7200 ← default
30
net.ipv4.tcp_keepalive_probes 9 ← default
Default : 
    7200(sec) +  75(sec)×9(times) 
    = 7200(sec) + 675(sec) = 7,875(sec) = 131.25(min) = 2.1875(hours)

After :
    30(sec) +  2(sec)×9(times) 
    = 30(sec) + 18(sec) = 48(sec)


File Handles

Parameter Value Note
fs.file-max 65536


Check

To determine the maximum number of file handles for the entire system

cat /proc/sys/fs/file-max



To determine the current usage of file handles

cat /proc/sys/fs/file-nr

The file-nr file displays three parameters:

  • the total allocated file handles.
  • the number of currently used file handles (with the 2.4 kernel); or the number of currently unused file handles (with the 2.6 kernel).
  • the maximum file handles that can be allocated (also found in /proc/sys/fs/file-max).



os/linux/kernel/sysctl.html.txt · Last modified: 2019/06/08 by admin

Page Tools