Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:/ Q6 v1 O3 Z7 e) g" N& z
, E* U( O1 B1 ~9 m# ~3 R3 F5 V6 h#vi /etc/sysctl.conf
8 K' s H7 l7 V### 寥脩頂蝯梯園蝞∠ ###6 t& V9 p% Y$ t4 x4 J
3 u) o& g8 y: ?8 w( V- N
, E; D6 w& ^! a: R: _# 憭扳獢inode敹怠; N) n# e3 a6 |# W
fs.file-max = 2097152
5 P4 X ~& q8 \4 Q8 D2 J# ]: G& Y) [* t1 c+ j. z5 u7 Z/ K1 ?" @
$ k7 v$ g& g0 {+ T* b# 頛撠鈭斗
7 ?( R7 d {$ Y0 S! Svm.swappiness = 10$ @% M2 U) G. Y3 W! l/ @$ a
vm.dirty_ratio = 60. @" K2 a. z) h- e6 }, I1 ]
vm.dirty_background_ratio = 2. ~: _) g% T, J% @. T
1 u, `+ `8 \4 L1 `6 r5 v, |( o2 z, F Q0 k! D
### 銝祉蝬脰楝摰券賊 ###* D4 H" _+ @0 G& z0 H
6 A$ Z. x' K c) [, S! B( K' P* [! _
?7 F3 W, I3 A P- z
# 鋡怠(passive)TCP亦SYNACKs甈⊥( L$ Y9 ^3 P( b; }7 P
net.ipv4.tcp_synack_retries = 2
' ?; B8 n! @3 e6 h3 @9 r
1 X, C0 o! s2 y+ H
# Y& D6 P7 a S3 ^" t5 Y# 閮望祆蝬脰楝仿蝭1 Y! f, W7 _$ K9 t
net.ipv4.ip_local_port_range = 2000 65535! Q( @! o& ]. @% X/ A
+ m- }% ?5 C! I
6 s# L# R z" [1 N4 D
# 貿CP Time-Wait靽霅 R: o' \8 ?9 U& K+ H) s; H, a8 Y7 e
net.ipv4.tcp_rfc1337 = 1
, A8 Y5 K* I* _
' |/ E+ E8 Y' Z' P1 u
+ m3 a# L+ z3 f, k3 d# j# 雿撠 tcp_fin_timeout connection 閮剖# B T; u- {9 n6 U' P! ~4 Z
net.ipv4.tcp_fin_timeout = 154 f* U, o' J( M/ c, V
& X9 s% y+ o. l8 i
, o( @+ Y7 Q" o( i7 ^2 T# H0 C6 {# 雿蝺摮瘣餅閮剖
8 r) ]* ?( T& a* g [net.ipv4.tcp_keepalive_time = 300
2 d4 n6 f8 N% Z$ D4 H; xnet.ipv4.tcp_keepalive_probes = 5$ _% n) [% e. K& k% [& g& l6 d
net.ipv4.tcp_keepalive_intvl = 15
2 q3 I6 u" J. P2 E# k4 L2 E
: T. [% s% K& ^2 }/ ?! T& F0 r
9 Z/ i$ E4 O$ K' Z+ P4 a### 隤踵渡雯頝舀 ###
1 M0 M+ R. `3 u0 g- n7 }8 I f3 O3 t/ p3 Z
5 [6 Z$ U" Y- f- z8 ~
# 閮剔Socket交嗥楨摮. @4 j# _# R% H& \
net.core.rmem_default = 314572809 e& F$ s$ K* t% h
( b! i% ?3 Q; k G3 t: I
) m' }7 z! }4 X _9 A# Y4 ] y9 X# 憭抒Socket交嗥楨摮$ ^# h, |3 V. N$ e4 T
net.core.rmem_max = 12582912
# P" ]+ Q+ S T" g. X; a, p% i' H1 ?
" `% R ?/ c' V! E7 e; y& c/ y0 Z# l0 ]' H9 V/ C2 n
# 閮剔Socket喲蝺拙
$ t5 I; o w h( ~! Onet.core.wmem_default = 31457280- i5 ~7 y5 O& x: E( y5 o ~8 X
; Z, z( P0 K. {- n+ Q
3 V, f) |/ k- H. K) ?
# 憭抒Socket喲蝺拙4 [5 \, _' R( @
net.core.wmem_max = 125829120 j2 \) ~! I- Q7 |; v
% ?) N5 u0 E, g( c
: v2 E# T5 g) f7 I- K
# 憭抒雯頝舫交2 U" Q+ \$ N7 o! L0 }
net.core.somaxconn = 4096
6 }: A7 D7 _% k- O& \* F
' a, [) g5 C5 \0 |8 B( i6 M5 o, b: g/ i0 B! \- J. e# h r
# 憭抒雯頝舫亦backlog
+ C6 F: N2 T' Q% J# Vnet.core.netdev_max_backlog = 65536
! S. r2 K+ w/ U( i. q
8 Y2 K2 }; J$ y6 _
2 w$ A) L' O, o/ |# 憭扯園蝺拙憭折* d# w% K+ C" I& |0 l; b; [
net.core.optmem_max = 25165824$ O/ Q1 c- @6 Y' e( ^7 H
3 {% B) ~+ j9 o8 a9 z4 p
a) ]; F6 `/ I" x- v9 d# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇
2 N" _3 o2 {' o- n( p. p# This is measured in units of pages (4096 bytes)% K7 Z0 s1 m0 n1 O" t
net.ipv4.tcp_mem = 65536 131072 2621448 n6 l5 e1 i6 M( h
net.ipv4.udp_mem = 65536 131072 262144
4 c" `! @6 {1 f. \3 ~
# g. G) |) ]% F
: x0 w! y- p: O6 P+ P% V# 憭扯蝺拙臬蝛粹1 K6 T, r0 I) o+ v' n
net.ipv4.tcp_rmem = 8192 87380 16777216/ U" q$ G4 o: }5 k" `! J$ g
net.ipv4.udp_rmem_min = 16384' h' J+ U" @: m ?% h# y, D
3 K" a: F8 s. h' h( N# g
+ ~" Y r. t9 A# 憭批神亦楨摮臬蝛粹. C; `4 p% D- d3 w
net.ipv4.tcp_wmem = 8192 65536 16777216
$ u& [) @3 I$ {7 X3 a1 _( ~net.ipv4.udp_wmem_min = 16384( c3 ]+ a! ^3 q1 b+ _
. g o' p3 U$ N0 ]! j) h4 X
" ~& B' K9 n% X/ M6 M2 G# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅
* V C! s* i$ j7 \) _! ?8 }net.ipv4.tcp_max_tw_buckets = 1440000 z: I" M z1 Y( M7 l5 I$ d9 u
net.ipv4.tcp_tw_recycle = 1
1 }& t+ ~( _1 f1 V! inet.ipv4.tcp_tw_reuse = 1
E- n9 Y5 h' q3 L% f7 l1 }5 |+ \7 J
. l% e4 Z' o0 f9 L2 f! N摮瑼隞亦
! D/ @$ q2 i+ j: c#sysctl -p 頛亙歇霈
0 z- E, A7 G, p5 }) m& d) H% T; N1 c) R
靘皞:" ?4 o7 D' m7 y' B; {+ N4 N, n
% k+ v5 z/ F/ p4 nhttps://easyengine.io/tutorials/linux/sysctl-conf/
2 ] O" w' \! d- q5 z3 n摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0
* o# ^/ |: |8 s6 P3 w: x$ B8 H+ p5 T% ?. l; e2 i: r% K
& z0 |! g; j+ n& {, [ E' ?0 I
/ b3 Z, y+ v: ^% @' j
|
|