Linux系統優化部分核心引數調優中文註釋

edwardking888發表於2011-03-03

應用伺服器sysctl.conf部分引數
## network configurations
net.ipv4.ip_forward = 0 # IP packet forwarding
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_fin_timeout=30  #60,每條至多佔 1.5K 的記憶體
net.ipv4.tcp_keepalive_time=1800 #7200
net.core.netdev_max_backlog=3000 #1000每個網路介面接收資料包的速率比核心處理這些包的速率快時,允許送到佇列的資料包的最大數目
net.ipv4.tcp_max_syn_backlog=4096  #1024 增加TCP SYN佇列長度,使系統可以處理更多的併發連線
net.core.wmem_default = 2097152 #108544,系統套接字緩衝區
net.core.rmem_default = 2097152 #108544,系統套接字緩衝區
net.core.rmem_max=16777216   #131071,系統套接字緩衝區
net.core.wmem_max=16777216 #131071,系統套接字緩衝區
net.ipv4.tcp_rmem=4096 87380 16777216  #4096   87380   174760, TCP接收緩衝區
net.ipv4.tcp_wmem=4096 65536 16777216 #4096  16384   131072, TCP傳送緩衝區
net.ipv4.tcp_mem = 786432 1048576 1572864 # Out of socket memory
net.ipv4.tcp_syncookies=1  #0,防SyncFlood攻擊
net.ipv4.ip_local_port_range = 32768 61000 #用於向外連線的埠範圍,這是預設值
net.ipv4.tcp_max_tw_buckets = 5000  #180000,同時保持TIME_WAIT套接字的最大數量
#以下可能需要載入ip_conntrack模組 modprobe ip_conntrack
# net.ipv4.ip_conntrack_max=6553600
# net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 1800
# net.ipv4.netfilter.ip_conntrack_max=6553600
# net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait=120
# net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait=60
# net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait=120
# net.ipv4.icmp_echo_ignore_all = 1 #0, Disable ping requests
# net.ipv4.icmp_echo_ignore_broadcasts = 1 #1, Enable ignoring broadcasts request
net.ipv4.neigh.default.gc_thresh3 = 40960 #1024
net.ipv4.neigh.default.gc_thresh2 = 20480 #512
net.ipv4.neigh.default.gc_thresh1 = 10240 #128
##以上三條語句可以解決核心中出現的如下兩行錯誤
#Linux kernel: printk: xxxxx messages suppressed.
#Linux kernel: Neighbour table overflow.

## system configurations
fs.file-max = 372901 #23712, 整個系統所有可開啟檔案總數的限制, 可按256/4M記憶體計算值。
# ulimit -n 10000 #某一程式可開啟檔案 總數的限制
# kernel.ctrl-alt-del = 1 #0,Disable CTR+ALT+DEL Restart Keys

附:sysctl.conf
fs.file-max = 372901
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=1800
net.core.netdev_max_backlog=3000
net.ipv4.tcp_max_syn_backlog=4096
net.core.wmem_default = 2097152
net.core.rmem_default = 2097152
net.ipv4.tcp_rmem=4096 87380 16777216
net.core.rmem_max=33554432
net.ipv4.tcp_wmem=4096 65536 16777216
net.core.wmem_max=33554432
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_max_tw_buckets = 180000
net.ipv4.ip_conntrack_max=6553600
net.ipv4.netfilter.ip_conntrack_max=6553600
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait=30
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait=60
net.ipv4.ip_local_port_range = 32768 61000

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8183550/viewspace-688333/,如需轉載,請註明出處,否則將追究法律責任。

相關文章