Linux tuning (memory, CPU)

I. Introduction to concepts

  • system call: system calls
  • time slice: cpu time slice
  • O (1): Linux system process scheduler
  • page frame: Page
  • RSS: permanent memory set can not be a page of data
  • MMU: memory management unit mapping table maintains a linear address space and physical address space
  • TLB: the conversion buffer
  • huge page: large page
  • NUMA: Non-uniform memory access, multiple-CPU, each CPU has its own memory segments, each segment is called a node, the process is recommended do CPU affinity binding

Two, CPU memory tuning

  • Affinity tune with the CPU process
# taskset -p mask pid
# taskset mask -- program
# taskset -c 0,,2-7 -- myprogram
# taskset -p -c 1 17947  #将pid为17947的进程绑定至第2颗CPU上,重启失效
  • View processes that are currently running on the CPU which pieces
# ps axo psr,pid,cmd
  • cpu interrupt statistics
# cat /proc/interrupts
  • numactl: Policy Management for MUMA
  • Adjust process priority: nice, renice
  • Isolation CPU, the CPU will not be quarantined interrupt processing
# vim /etc/grub.conf
    kernel ...... lsolcpus=1,2,3...
  • Scheduling categories:
SCHED_FIFO [0-99]
    chrt -f [1-99] /path/to/program arguments
SCHED_RR
    chrt -f [1-99] /path/to/program arguments
SCHED_NORMAL [100-139]
    nice,renice
  • 0 - 139
1-99:实时优先级
100-139:动态优先级
  • Performance monitoring tools
htop
dstat
glances
sysdig
sar -P ALL 1 2
vmstat 1 5
iostat -c 1
  • Configuring large page
vm.nr_hugepages = 10
  • The current system maximum number of files open
fs.file-max = 8192
  • So the current asynchronous io allow the maximum number of system events
fs.aio-max-nr = 65535
  • OOM adjustable parameters
vm.panic_on_oom = 0
/proc/pid/oom_adj  [-16-15] #数字越高,被杀死的值越大,如果是-17则这个进程是无懈可击的

Third, memory summary

nr_hugepages
swapiness
overcommit_memory

Guess you like

Origin www.cnblogs.com/L-dongf/p/11068678.html