net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_keepalive_time = 7200   #基于业务长连接多,保持默认
net.ipv4.tcp_keepalive_intvl = 75 
net.ipv4.tcp_keepalive_probes =9
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.ip_forward = 1
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
fs.file-max = 52706963
fs.nr_open = 52706963

vm.admin_reserve_kbytes =   16384 
vm.swappiness = 0
vm.overcommit_memory=1
vm.panic_on_oom=0
kernel.core_pattern = /tmp/core-%e-%p-%t 
kernel.threads-max = 25165824  (此值应该是根据服务器具体内存计算)
kernel.pid_max = 655360
vm.max_map_count = 8388608


net.netfilter.nf_conntrack_max=2310720
net.netfilter.nf_conntrack_tcp_timeout_established=84600
net.core.netdev_max_backlog=262144
net.ipv4.neigh.default.gc_thresh1=1024
net.ipv4.neigh.default.gc_thresh2=4096
net.ipv4.neigh.default.gc_thresh3=8192

vm.dirty_background_ratio = 5 

vm.dirty_ratio = 10 

fs.protected_hardlinks=1

fs.protected_symlinks=1

net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr   (如果内核是4.9 以上,可以添加此参数)


fs.inotify.max_user_instances= 8192
fs.inotify.max_queued_events= 16384
fs.inotify.max_user_watches= 524288

kernel.shmmax = 92771293593  可以根据具体总内存计算 (推荐值96G内存节点)
kernel.shmmni = 4096
kernel.shmall = 22649241          根据具体总内存计算 (推荐值96G内存节点)
kernel.sem = 250 32000 100 128

net.core.optmem_max = 16777216
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_default = 8388608
net.core.wmem_max = 16777216
net.ipv4.tcp_mem = 1541646 2055529 3083292  系统会自动随着自身内存实际情况分配(单位是页)(基于96G内存的建议)
net.ipv4.tcp_wmem = 4096 8388608 16777216
net.ipv4.tcp_rmem = 4096 8388608 16777216

net.ipv4.tcp_moderate_rcvbuf = 1

net.ipv4.tcp_adv_win_scale = 2







---------------------------------------------------------------------------------

验证是否开启bbr 
sysctl net.ipv4.tcp_available_congestion_control

如果是以下返回,就算配置成功

net.ipv4.tcp_available_congestion_control = bbr cubic reno   

 lsmod | grep bbr

如果是以下返回,就算配置成功

 tcp_bbr                20480  59

----------------------------------------------------------------------------------

用于生产线K8S集群中的内核参数调优 (一般情况下,不建议启动bbr)

net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.core.default_qdisc = pfifo_fast
net.ipv4.tcp_congestion_control = cubic
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes =9
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.ip_forward = 1
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
fs.file-max = 52706963
fs.nr_open = 52706963
vm.admin_reserve_kbytes =16384
vm.swappiness = 0
vm.overcommit_memory=1
vm.panic_on_oom=0
kernel.core_pattern = /tmp/core-%e-%p-%t
kernel.threads-max = 33554432
kernel.pid_max = 655360
vm.max_map_count = 67108864
net.netfilter.nf_conntrack_max=2310720
net.netfilter.nf_conntrack_tcp_timeout_established=86400
net.core.netdev_max_backlog=262144
net.ipv4.neigh.default.gc_thresh1=1024
net.ipv4.neigh.default.gc_thresh2=4096
net.ipv4.neigh.default.gc_thresh3=8192
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
fs.protected_hardlinks=1
fs.protected_symlinks=1
fs.inotify.max_user_instances= 8192
fs.inotify.max_queued_events= 16384
fs.inotify.max_user_watches= 524288
kernel.shmmax = 123695058126
kernel.shmmni = 4096
kernel.shmall = 30198988
kernel.sem = 250 32000 100 128
net.core.optmem_max = 16777216
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_default = 8388608
net.core.wmem_max = 16777216
net.ipv4.tcp_mem = 1541646 2055529 3083292
net.ipv4.tcp_wmem = 4096 8388608 16777216
net.ipv4.tcp_rmem = 4096 8388608 16777216
net.ipv4.tcp_moderate_rcvbuf = 1
net.ipv4.tcp_adv_win_scale = 2
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐