linux 系統調優
1,用戶最大進程數配置
Centos5環境修改/etc/security/limits.conf文件
Centos6環境修改/etc/security/limits.d/90-nproc.conf文件
[email protected]:/data/tools/db# vim /etc/security/limits.conf
* soft nofile 65535 * soft nproc 65535 * hard nofile 65535 * hard nproc 65535
[email protected]:/data/tools/db# cd /etc/security/limits.d/
[email protected]:/etc/security/limits.d# vim 90-nofile.conf
* soft nofile 65535 * hard nofile 65535 root soft nofile unlimited
內核調優
vim /etc/sysctl.conf 修改後 sysctl -p 生效
# 內核panic時,30秒後自動重啟
kernel.panic = 30
#
# # 允許更多的PIDs (減少滾動翻轉問題); may break some programs 32768
kernel.pid_max = 32768
#
# # 內核所允許的最大共享內存段的大小(bytes)
kernel.shmmax = 16777216
#
# # 在任何給定時刻,系統上可以使用的共享內存的總量(pages)
kernel.shmall = 4194304
#
# # 設定程序core時生成的文件名格式
kernel.core_pattern = core_%e
#
# # 當發生oom時,自動轉換為panic
vm.panic_on_oom = 1
#
# # 表示強制Linux VM最低保留多少空閑內存(Kbytes)
38,1 11%
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.
# 內核panic時,30秒後自動重啟
kernel.panic = 30
#
# # 允許更多的PIDs (減少滾動翻轉問題); may break some programs 32768
kernel.pid_max = 32768
#
# # 內核所允許的最大共享內存段的大小(bytes)
kernel.shmmax = 16777216
4,1 0%
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
#
# # 表示是否啟用以一種比超時重發更精確的方法(請參閱 RFC 1323)來啟用對 RTT 的計算;為>了實現更好的性能應該啟用這個選項
net.ipv4.tcp_timestamps = 1
#
# # 表示本機向外發起TCP SYN連接超時重傳的次數
net.ipv4.tcp_syn_retries = 4
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
kernel.core_uses_pid = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# 內核panic時,30秒後自動重啟
kernel.panic = 30
#
# # 允許更多的PIDs (減少滾動翻轉問題); may break some programs 32768
kernel.pid_max = 32768
#
# # 內核所允許的最大共享內存段的大小(bytes)
kernel.shmmax = 16777216
#
# # 在任何給定時刻,系統上可以使用的共享內存的總量(pages)
kernel.shmall = 4194304
#
# # 設定程序core時生成的文件名格式
kernel.core_pattern = core_%e
11,0-1 6%
net.ipv4.tcp_synack_retries = 4
#
# # 減少處於FIN-WAIT-2連接狀態的時間,使系統可以處理更多的連接。
net.ipv4.tcp_fin_timeout = 30
#
# # 減少TCP KeepAlive連接偵測的時間,使系統可以處理更多的連接。
# # 如果某個TCP連接在idle 300秒後,內核才發起probe.如果probe 2次(每次2秒)不成功,內核才徹
底放棄,認為該連接已失效.
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 2
#
# # 系統所能處理不屬於任何進程的TCP sockets最大數量
net.ipv4.tcp_max_orphans = 262144
#
# # 系統同時保持TIME_WAIT套接字的最大數量,如果超過這個數字,TIME_WAIT套接字將立刻被清>除並打印警告信息。
net.ipv4.tcp_max_tw_buckets = 40000
#
# # arp_table的緩存限制優化
net.ipv4.neigh.default.gc_thresh1 = 256
net.ipv4.neigh.default.gc_thresh2 = 1024
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.lo.arp_announce=2
linux 系統調優