总结了一下, 贴出来一个 /etc/sysctl.conf
供参考. 实测效果良好.
推荐前提环境:
- Debian 10 / 11 / 12 (推荐有条件的一律升级至 Debian 12, 不用担心占用问题, 384M 内存以上也能运行良好, CentOS 就算了)
- KVM 虚拟化(LXC 没用过, 不保证可用)
- 384M 以上内存(更低的没有测试, 缓冲区相关配置均和内存相关需要实测)
辅以安装 Xanmod 内核 食用效果更佳.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
net.ipv4.tcp_timestamps=1
net.core.wmem_default=16384 net.core.rmem_default=262144 net.core.rmem_max=536870912 net.core.wmem_max=536870912 net.ipv4.tcp_rmem=8192 262144 536870912 net.ipv4.tcp_wmem=4096 16384 536870912 net.ipv4.tcp_adv_win_scale=-2 net.ipv4.tcp_collapse_max_bytes=6291456 net.ipv4.tcp_notsent_lowat=131072 net.core.netdev_max_backlog=10240 net.ipv4.tcp_max_syn_backlog=10240 net.core.somaxconn=8192 net.ipv4.tcp_abort_on_overflow=1
net.core.default_qdisc=fq
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_slow_start_after_idle=0
net.nf_conntrack_max=1000000 net.netfilter.nf_conntrack_max=1000000 net.netfilter.nf_conntrack_tcp_timeout_fin_wait=30 net.netfilter.nf_conntrack_tcp_timeout_time_wait=30 net.netfilter.nf_conntrack_tcp_timeout_close_wait=15 net.netfilter.nf_conntrack_tcp_timeout_established=300 net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=7200
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_max_tw_buckets=55000
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_syn_retries=3 net.ipv4.tcp_synack_retries=3
net.ipv4.tcp_retries2=5
net.ipv4.tcp_syncookies=0
net.ipv4.conf.default.rp_filter=2 net.ipv4.conf.all.rp_filter=2
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_no_metrics_save=1
net.unix.max_dgram_qlen=1024
net.ipv4.route.gc_timeout=100
net.ipv4.tcp_mtu_probing = 1
net.ipv4.conf.all.log_martians=1 net.ipv4.conf.default.log_martians=1
net.ipv4.conf.all.accept_source_route=0 net.ipv4.conf.default.accept_source_route=0
net.ipv4.tcp_keepalive_time=300
net.ipv4.tcp_keepalive_probes=2
net.ipv4.tcp_keepalive_intvl=2
net.ipv4.tcp_max_orphans=262144
net.ipv4.neigh.default.gc_thresh1=128 net.ipv4.neigh.default.gc_thresh2=512 net.ipv4.neigh.default.gc_thresh3=4096 net.ipv4.neigh.default.gc_stale_time=120 net.ipv4.conf.default.arp_announce=2 net.ipv4.conf.lo.arp_announce=2 net.ipv4.conf.all.arp_announce=2
kernel.panic=1
kernel.pid_max=32768
kernel.shmmax=4294967296
kernel.shmall=1073741824
kernel.core_pattern=core_%e
vm.panic_on_oom=1
vm.vfs_cache_pressure=250
vm.swappiness=10
vm.dirty_ratio=10 vm.overcommit_memory=1
fs.file-max=1048575 fs.inotify.max_user_instances=8192 fs.inotify.max_user_instances=8192
kernel.sysrq=1
vm.zone_reclaim_mode=0
|
转自:https://www.nodeseek.com/post-37225-1