wiki:jazz/Performance_Tuning

Version 11 (modified by jazz, 15 years ago) (diff)

--

Performance Tuning

System Performance Tuning : Memory

  • Share Memory - 有些程式需要用到比較多 Share Memory (共享記憶體), 如: Kerrighed (2008-03-20 (rock/rider))
    echo "kernel.shmall = 796917578" >> /etc/sysctl.conf
    echo "kernel.shmmax = 796917578" >> /etc/sysctl.conf
    echo "kernel.shmmni = 4096"      >> /etc/sysctl.conf
    

System Performance Tuning : File System

  • /etc/security/limits.conf - 每個程序(process)可以開啟檔案的個數(number limits of open files per process) - 像 HDFS 的 DataNode 就需要調整這種參數(2010-02-22)
    • /etc/security/limits.conf

      old new  
      4949#ftp             -       chroot          /ftp
      5050#@student        -       maxlogins       4
      5151
       52*      soft        nofile        8192
       53
      5254# End of file
  • [參考] Increasing the file descriptor limit

I/O Performance Tuning : NFS

  • NFS Tuning - /etc/fstab - 加大 NFS read/write size 可以提升檔案系統的 I/O 效率 (2008-03-20 (rock/rider))
    192.168.0.111:/home /home nfs rw,bg,soft,intr,rsize=262144,wsize=262144 0 4
    192.168.0.111:/opt  /opt  nfs ro,bg,soft,intr,rsize=262144,wsize=262144 0 4
    192.168.0.111:/usr  /usr  nfs ro,bg,soft,intr,rsize=262144,wsize=262144 0 4
    

I/O Performance Tuning : IOWait

  • 2010-03-31 : 高 IOWait 有什麼好的解決之道呢??

Network Performance Tuning

  • TCP Tuning - (2008-03-20 (LSI))
    echo 262144               > /proc/sys/net/core/rmem_default
    echo 8388608              > /proc/sys/net/core/wmem_max
    echo 8388608              > /proc/sys/net/core/rmem_max
    echo "4096 87380 4194304" > /proc/sys/net/ipv4/tcp_rmem
    echo "4096 65536 4194304" > /proc/sys/net/ipv4/tcp_wmem
    
  • TCP TIME_WAIT & Reuse - 適用網站伺服器 (2010-03-26)
    echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout 
    sysctl net.ipv4.tcp_tw_reuse=1
    sysctl net.ipv4.tcp_tw_recycle=1
    
  • 如果沒辦法 ping 224.0.0.1 的話,代表 Broadcast ICMP 封包被濾掉了,因為預設 Linux kernel 2.6 是 disable 的。解法如下:(2009-09-07)
    echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
    
    ~# echo "net.ipv4.icmp_echo_ignore_broadcasts = 0" >> /etc/sysctl.conf
    ~# sysctl -p
    net.ipv4.ip_forward = 1
    net.ipv4.icmp_echo_ignore_broadcasts = 0
    

Power Management

  • 啟動 SATA ALPM 電源管理功能 - powertop 提供之建議
    echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
    
  • 虛擬機器的 clocksource ([wiki/jazz/Trac_Updates#a2010-02-11 2010-02-11])
    echo acpi_pm > /sys/devices/system/clocksource/clocksource0/current_clocksource
    
  • 直接修改系統參數讓 Linux 休眠 (2010-03-03 (rock))
    # echo 4 > /proc/acpi/sleep  /** 適用 Kernel 2.4 (swsusp)**/
    # echo disk > /sys/power/state  /** 適用 Kernel 2.4 & 2.6 (swsusp)**/
    

Security