Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:
. q0 {3 U3 f0 V6 J" K3 D! A7 [- c2 D/ P1 u; I
#vi /etc/sysctl.conf3 p ~" P. K( |/ c
### 寥脩頂蝯梯園蝞∠ ###3 v( q4 W6 q$ N1 u$ i* }
/ t) t9 A8 l3 Z k; E
( _/ @ N9 C) T3 |$ p4 d
# 憭扳獢inode敹怠
! G7 |" n2 f. z/ Afs.file-max = 2097152
$ K2 r0 d5 w( N8 d' L* Z/ Q+ n1 ?" q0 P& u+ c4 |
}2 l+ M, N9 N: z7 j) J
# 頛撠鈭斗4 V; d* c% C% z6 L6 a
vm.swappiness = 10* C: ]- d) D9 o1 k" l7 |5 c
vm.dirty_ratio = 608 f" _7 P. u9 h) A- p, F
vm.dirty_background_ratio = 2
! l- z( I8 s# g: _, O4 h, \3 A" ] q* S* W9 z* |
- E, ?' J7 G) E# [4 o, E
### 銝祉蝬脰楝摰券賊 ###) E5 p9 s+ u# s; Q+ V9 t
% ^0 I! C/ y$ ?) M4 q5 C7 m0 f& Y \! A# \
# 鋡怠(passive)TCP亦SYNACKs甈⊥
* B! m1 \- v% N% c( i, n" U; }net.ipv4.tcp_synack_retries = 2
8 ]/ ]0 q2 b* ]9 [- A, B: u7 X& @2 l
' J3 L0 a6 Y7 f. T3 z. `
# 閮望祆蝬脰楝仿蝭8 U7 }$ N2 O& [+ ]
net.ipv4.ip_local_port_range = 2000 65535
+ L. S7 x, U# G% a' h$ W! Z4 \* R& |/ b' E8 k7 K5 W; B
( _1 A3 m" A' v! ^7 S# 貿CP Time-Wait靽霅5 Q$ Y- F2 y ]& P+ j( y
net.ipv4.tcp_rfc1337 = 1
E$ t, \9 \" H$ M1 p+ u1 r, |! M- Y* A! D$ Y, C
( j8 `8 D" c2 E
# 雿撠 tcp_fin_timeout connection 閮剖" @0 M% \* v+ L* P9 x$ j7 D" [$ U/ h
net.ipv4.tcp_fin_timeout = 15. m3 J3 ~2 e: |* B @2 B# ?+ F% h- A
$ k2 M8 h" M N+ ]( G; }6 a$ ~
: l7 T- ]1 |8 J% d" A0 K4 c. H# 雿蝺摮瘣餅閮剖 x' j2 x) a( O" _) J6 q3 b4 p G
net.ipv4.tcp_keepalive_time = 3008 H j$ u& }/ R3 O3 x6 d( {/ p& \
net.ipv4.tcp_keepalive_probes = 5; I# G6 ]0 w# o$ n: [* ~6 H
net.ipv4.tcp_keepalive_intvl = 15
% D" b. @' }- D$ z/ }$ J2 [# g! h. p6 w2 ?8 `: C Z! Y: l9 Q
% x- S4 p6 A8 @: l4 {### 隤踵渡雯頝舀 ###
4 U! s$ C( p+ R$ P2 ?
5 h% f Q k- r3 q! Y( m( A: W( U6 A/ f! ?
# 閮剔Socket交嗥楨摮
) l: I& I! r% Rnet.core.rmem_default = 31457280
7 g9 N n9 I! |1 D2 H$ B: P9 _2 h2 M9 N: f
+ Q; n$ L$ x. V. k" }" s
# 憭抒Socket交嗥楨摮
7 D! c5 H, @& Q( ynet.core.rmem_max = 12582912
9 k: C* f% e: B3 R- B, Q; `: D' Z: K# ?9 g- T: D/ X
( z% i+ |0 {! C8 q& T2 W
# 閮剔Socket喲蝺拙
5 v/ N+ C7 w n% A" E, P8 \net.core.wmem_default = 31457280! S1 I% k- b' y# o5 D6 F9 U- m
1 C9 `2 E& M" X z" W3 R! n. P; j
% [! J! c, D$ c; h
# 憭抒Socket喲蝺拙
5 ?1 H( \; d) Y% j. u% Enet.core.wmem_max = 12582912
% M8 ]! P! D, ~ `% T# `0 {5 b& V; B* H2 A$ `
Z4 _$ d0 }- {0 C+ p4 U/ P
# 憭抒雯頝舫交
) l. G; N7 X K: f) l2 ^$ a4 |$ {net.core.somaxconn = 4096
1 z& w: }% B0 n8 q# @4 o2 ]
" {, B6 Y3 D+ A* ?7 M- A1 O
0 G$ f" f: f! `. h- I# {# 憭抒雯頝舫亦backlog5 b; d4 j! K6 B
net.core.netdev_max_backlog = 655366 B2 C3 b$ U! b7 Z4 o
5 J1 m$ {4 [0 k# T: k5 L
0 d9 j* D1 p( l: `; x# 憭扯園蝺拙憭折( ~9 C2 S! ?+ l# |
net.core.optmem_max = 25165824 V, A& j# K5 r% V8 e! f
/ ]% e9 B- O2 ?" ?) N7 X$ {
+ j1 ` w# P! E( q* w# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇3 V4 t. K! L3 T$ h
# This is measured in units of pages (4096 bytes)! Q8 L! d# S/ D4 Y3 B, ?
net.ipv4.tcp_mem = 65536 131072 262144
" {& Z8 `0 I: V: d% z! w2 wnet.ipv4.udp_mem = 65536 131072 262144. {; f# V5 o$ |7 j* y2 ?+ k7 S
" C9 E: W& x; s
* ~+ e# `- ]9 k1 V/ A
# 憭扯蝺拙臬蝛粹
2 }4 \4 y( d3 Bnet.ipv4.tcp_rmem = 8192 87380 16777216. ^; `# u* B0 q N, S% a+ y
net.ipv4.udp_rmem_min = 16384" T: H* {7 \9 y
- h8 d. R4 p, P) |
( Y# w/ c( L L# 憭批神亦楨摮臬蝛粹
$ l$ j# v( y2 z( m" nnet.ipv4.tcp_wmem = 8192 65536 16777216
) q, {" i" m( U3 |net.ipv4.udp_wmem_min = 16384
9 U8 j2 k5 c4 A/ [& B- D$ W" M. G- w: u$ }
3 ~ U9 e( S \7 O) \3 z, L" `9 i
# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅
( S# E7 N, j0 Znet.ipv4.tcp_max_tw_buckets = 1440000% ]( @& O- i3 U; _) R' W& z* A' D
net.ipv4.tcp_tw_recycle = 18 u/ e- k$ T, A, m4 [" L6 q! T }
net.ipv4.tcp_tw_reuse = 1
0 m, x K$ g, U
* O3 N8 k& ?) T, j/ q h8 ?0 g& n/ r. |5 @& p6 d! F+ i4 e
摮瑼隞亦. h) z# B, v' z% n5 L5 T8 C. e
#sysctl -p 頛亙歇霈
" J3 i3 |1 _" e5 R8 H
# O7 D; G! X9 V5 A9 z靘皞:& f/ |0 R9 i+ U. B6 y8 K
5 ?" S' {0 g$ V; \5 T2 f. V4 Y5 fhttps://easyengine.io/tutorials/linux/sysctl-conf/
6 J9 R! J: Y! I- g3 E) i摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0
6 m0 {: I& G" x- _$ d) s" { z8 Z
. A% z4 H# W- z
. k4 ^1 y! y7 c* F0 z( Z |
|