方案一:Linux TCP/IP內(nèi)核參數(shù)調(diào)優(yōu),網(wǎng)絡(luò)高延遲大吞吐。_net.ipv4.tcp_wmem_liulilittle的博客-CSDN博客
nano /etc/sysctl.conf
vm.overcommit_memory=1
net.core.rps_sock_flow_entries=32768 #rfs 設(shè)置此文件至同時活躍連接數(shù)的最大預期值
#net.ipv4.icmp_echo_ignore_all=1 #禁止ping
#net.ipv4.icmp_echo_ignore_broadcasts=1
fs.file-max=1000000 # 系統(tǒng)級別的能夠打開的文件句柄的數(shù)量
fs.inotify.max_user_instances=65536
#開啟路由轉(zhuǎn)發(fā)
net.ipv4.conf.all.route_localnet=1
net.ipv4.ip_forward=1
net.ipv4.conf.all.forwarding=1
net.ipv4.conf.default.forwarding=1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.lo.forwarding = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.all.accept_ra = 2
net.ipv6.conf.default.accept_ra = 2
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0
#ARP回應的級別
#net.ipv4.conf.all.arp_ignore=2
#net.ipv4.conf.default.arp_ignore=2
#net.ipv4.conf.all.arp_announce=2
#net.ipv4.conf.default.arp_announce=2
net.ipv4.neigh.default.gc_stale_time=60 #ARP緩存的存活時間
net.ipv4.tcp_syncookies=1 #開啟SYN Cookies。當出現(xiàn)SYN等待隊列溢出時,啟用cookies來處理
net.ipv4.tcp_retries1=3
net.ipv4.tcp_retries2=8
net.ipv4.tcp_syn_retries=2 #SYN重試次數(shù)
net.ipv4.tcp_synack_retries=2 #SYNACK重試次數(shù)
net.ipv4.tcp_tw_reuse=1 #開啟TIME-WAIT sockets重用
net.ipv4.tcp_fin_timeout=15 #保持在FIN-WAIT-2狀態(tài)的時間
net.ipv4.tcp_max_tw_buckets=32768 #系統(tǒng)同時保持TIME_WAIT socket的數(shù)量
#net.core.busy_poll=50
#net.core.busy_read=50
net.core.dev_weight=4096
net.core.netdev_budget=65536
net.core.netdev_budget_usecs=4096
net.ipv4.tcp_max_syn_backlog=262144 #對于還未獲得對方確認的連接請求,可保存在隊列中的最大數(shù)目
net.core.netdev_max_backlog=32768 #網(wǎng)口接收數(shù)據(jù)包比內(nèi)核處理速率快狀態(tài)隊列的數(shù)量
net.core.somaxconn=32768 #每個端口最大的監(jiān)聽隊列的數(shù)量
net.ipv4.tcp_notsent_lowat=16384
net.ipv4_timestamps=0 #TCP時間戳的支持
net.ipv4.tcp_keepalive_time=600 #TCP發(fā)送keepalive探測消息的間隔時間(秒)
net.ipv4.tcp_keepalive_probes=5 #TCP發(fā)送keepalive探測確定連接已經(jīng)斷開的次數(shù)
net.ipv4.tcp_keepalive_intvl=15 #探測消息未獲得響應時,重發(fā)該消息的間隔時間
vm.swappiness=1
net.ipv4.route.gc_timeout=100
net.ipv4.neigh.default.gc_thresh1=1024 #最小保存條數(shù)。當鄰居表中的條數(shù)小于該數(shù)值,則 GC 不會做任何清理
net.ipv4.neigh.default.gc_thresh2=4096 #高于該閾值時,GC 會變得更激進,此時存在時間大于 5s 的條目會被清理
net.ipv4.neigh.default.gc_thresh3=8192 #允許的最大臨時條目數(shù)。當使用的網(wǎng)卡數(shù)很多,或直連了很多其它機器時考慮增大該參數(shù)。
net.ipv6.neigh.default.gc_thresh1=1024
net.ipv6.neigh.default.gc_thresh2=4096
net.ipv6.neigh.default.gc_thresh3=8192
net.netfilter.nf_conntrack_max=262144
net.nf_conntrack_max=262144
net.netfilter.nf_conntrack_tcp_timeout_established=36000 #ESTABLISHED狀態(tài)連接的超時時間
# TCP窗口
net.ipv4.tcp_fastopen=3 # 開啟TCP快速打開
net.ipv4.tcp_autocorking=0
net.ipv4.tcp_slow_start_after_idle=0 #關(guān)閉TCP的連接傳輸?shù)穆龁?net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_frto=0
net.ipv4.tcp_mtu_probing=0
net.ipv4.tcp_rfc1337=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_adv_win_scale=1
net.ipv4.tcp_moderate_rcvbuf=1
net.core.rmem_max=33554432
net.core.wmem_max=33554432
net.ipv4.tcp_rmem=4096 87380 33554432
net.ipv4.tcp_wmem=4096 16384 33554432
net.ipv4.udp_rmem_min=8192
net.ipv4.udp_wmem_min=8192
net.ipv4.tcp_mem=262144 1048576 4194304
net.ipv4.udp_mem=262144 524288 1048576
# BBR
net.ipv4.tcp_congestion_control=bbr
net.core.default_qdisc=fq
sysctl -p文章來源:http://www.zghlxwxcb.cn/news/detail-607211.html
另類設(shè)置文章來源地址http://www.zghlxwxcb.cn/news/detail-607211.html
vm.overcommit_memory=1
net.core.rps_sock_flow_entries=32768 #rfs 設(shè)置此文件至同時活躍連接數(shù)的最大預期值
#net.ipv4.icmp_echo_ignore_all=1 #禁止ping
#net.ipv4.icmp_echo_ignore_broadcasts=1
fs.file-max=1000000 # 系統(tǒng)級別的能夠打開的文件句柄的數(shù)量
fs.inotify.max_user_instances=65536
#開啟路由轉(zhuǎn)發(fā)
net.ipv4.conf.all.route_localnet=1
net.ipv4.ip_forward=1
net.ipv4.conf.all.forwarding=1
net.ipv4.conf.default.forwarding=1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.lo.forwarding = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.all.accept_ra = 2
net.ipv6.conf.default.accept_ra = 2
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0
#ARP回應的級別
#net.ipv4.conf.all.arp_ignore=2
#net.ipv4.conf.default.arp_ignore=2
#net.ipv4.conf.all.arp_announce=2
#net.ipv4.conf.default.arp_announce=2
net.ipv4.neigh.default.gc_stale_time=60 #ARP緩存的存活時間
net.ipv4.tcp_syncookies=1 #開啟SYN Cookies。當出現(xiàn)SYN等待隊列溢出時,啟用cookies來處理
net.ipv4.tcp_retries1=3
net.ipv4.tcp_retries2=8
net.ipv4.tcp_syn_retries=2 #SYN重試次數(shù)
net.ipv4.tcp_synack_retries=2 #SYNACK重試次數(shù)
net.ipv4.tcp_tw_reuse=1 #開啟TIME-WAIT sockets重用
net.ipv4.tcp_fin_timeout=15 #保持在FIN-WAIT-2狀態(tài)的時間
net.ipv4.tcp_max_tw_buckets=32768 #系統(tǒng)同時保持TIME_WAIT socket的數(shù)量
#net.core.busy_poll=50
#net.core.busy_read=50
net.core.dev_weight=4096
net.core.netdev_budget=65536
net.core.netdev_budget_usecs=4096
net.ipv4.tcp_max_syn_backlog=262144 #對于還未獲得對方確認的連接請求,可保存在隊列中的最大數(shù)目
net.core.netdev_max_backlog=32768 #網(wǎng)口接收數(shù)據(jù)包比內(nèi)核處理速率快狀態(tài)隊列的數(shù)量
net.core.somaxconn=32768 #每個端口最大的監(jiān)聽隊列的數(shù)量
net.ipv4.tcp_notsent_lowat=16384
net.ipv4_timestamps=0 #TCP時間戳的支持
net.ipv4.tcp_keepalive_time=600 #TCP發(fā)送keepalive探測消息的間隔時間(秒)
net.ipv4.tcp_keepalive_probes=5 #TCP發(fā)送keepalive探測確定連接已經(jīng)斷開的次數(shù)
net.ipv4.tcp_keepalive_intvl=15 #探測消息未獲得響應時,重發(fā)該消息的間隔時間
vm.swappiness=1
net.ipv4.route.gc_timeout=100
net.ipv4.neigh.default.gc_thresh1=1024 #最小保存條數(shù)。當鄰居表中的條數(shù)小于該數(shù)值,則 GC 不會做任何清理
net.ipv4.neigh.default.gc_thresh2=4096 #高于該閾值時,GC 會變得更激進,此時存在時間大于 5s 的條目會被清理
net.ipv4.neigh.default.gc_thresh3=8192 #允許的最大臨時條目數(shù)。當使用的網(wǎng)卡數(shù)很多,或直連了很多其它機器時考慮增大該參數(shù)。
net.ipv6.neigh.default.gc_thresh1=1024
net.ipv6.neigh.default.gc_thresh2=4096
net.ipv6.neigh.default.gc_thresh3=8192
net.netfilter.nf_conntrack_max=262144
net.nf_conntrack_max=262144
net.netfilter.nf_conntrack_tcp_timeout_established=36000 #ESTABLISHED狀態(tài)連接的超時時間
# TCP窗口
net.ipv4.tcp_fastopen=3 # 開啟TCP快速打開
net.ipv4.tcp_autocorking=0
net.ipv4.tcp_slow_start_after_idle=0 #關(guān)閉TCP的連接傳輸?shù)穆龁?net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_frto=0
net.ipv4.tcp_mtu_probing=0
net.ipv4.tcp_rfc1337=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_adv_win_scale=1
net.ipv4.tcp_moderate_rcvbuf=1
net.core.rmem_max=33554432
net.core.wmem_max=33554432
net.ipv4.tcp_rmem=65536 1048576 33554432
net.ipv4.tcp_wmem=65536 1048576 33554432
net.ipv4.udp_rmem_min=8192
net.ipv4.udp_wmem_min=8192
net.ipv4.tcp_mem=262144 1048576 4194304
net.ipv4.udp_mem=262144 524288 1048576
# BBR
net.ipv4.tcp_congestion_control=bbrplus
net.core.default_qdisc=fq
到了這里,關(guān)于Linux TCP/IP內(nèi)核參數(shù)調(diào)優(yōu),網(wǎng)絡(luò)高延遲大吞吐(方案二)。的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!