009_系统参数调优

一、调优实战

二、

bdns

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
 
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
 
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
 
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
 
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
 
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 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
 
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
 
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
 
net.ipv4.ip_local_port_range = 10000  65535
 
net.ipv4.tcp_tw_reuse = 1
 
net.ipv4.tcp_syncookies = 1
 
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6=1
 
#baidu
net.ipv4.tcp_mem = 4632768      6177024 9265536
net.ipv4.tcp_wmem = 4096        2500000 8388608
net.ipv4.tcp_rmem = 4096        2500000 8388608
net.core.wmem_max = 5000000
net.core.rmem_max = 5000000
net.core.netdev_max_backlog = 65535
net.core.somaxconn = 65535

zb1

# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.lo.arp_announce=2
kernel.sysrq=1
net.ipv4.tcp_synack_retries=2
net.core.rmem_default=8388608
net.ipv4.tcp_mem=12582912 12582912 12582912
net.ipv4.tcp_congestion_control=cubic
net.ipv4.tcp_keepalive_probes=2
kernel.sem=5010 641280 5010 300
net.core.wmem_default=8388608
net.ipv4.tcp_syn_retries=1
net.ipv4.tcp_slow_start_after_idle=0
net.ipv6.conf.all.disable_ipv6=1
vm.max_map_count=262144
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_keepalive_time=300
net.nf_conntrack_max=2097152
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_moderate_rcvbuf=1
net.core.rmem_max=16777216
fs.file-max=655360
net.core.somaxconn=65535
net.ipv4.tcp_max_syn_backlog=3240000
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_max_tw_buckets=262144
net.ipv4.ip_local_reserved_ports=29090,29091,29098,29081,29097,29093,29099,29200,29101,27000,28000,22223,22222,26501,26502,26503,26401,29500-29600
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_retries2=5
net.ipv4.tcp_keepalive_intvl=15
net.ipv4.tcp_wmem=4096 65536 16777216
net.core.wmem_max=16777216
vm.swappiness=0
net.core.netdev_max_backlog=65535
net.netfilter.nf_conntrack_max=2097152
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_fin_timeout=10
net.ipv4.ip_local_port_range=20000 64999
net.ipv4.tcp_tw_recycle=0
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.ipv4.tcp_fastopen=1

参考:https://colobu.com/2014/09/18/linux-tcpip-tuning/

三、TCP监控

(1)In Segs

数据源: /proc/net/snmp; 采集方式:累计值,每10秒采集一次取差值; 指标:net.snmp.tcp (key: system);
In Segs: tcp协议层收到的数据包个数, in_segs/10 -> op/s;

原文地址:https://www.cnblogs.com/itcomputer/p/10638242.html