Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:1 q6 o9 G$ y8 k0 N* N* A; I4 I
& x1 A' C6 B8 A( R#vi /etc/sysctl.conf) n; o, I' D" N' j
### 寥脩頂蝯梯園蝞∠ ###
% s0 n2 M! _' b0 ]% a
" v' ~' Y [1 h0 s, m8 ^5 X
+ c: m7 Y$ u) a# 憭扳獢inode敹怠
$ G \' f) d( M2 Ofs.file-max = 2097152
7 e5 l* `/ Y2 b' a; H8 l+ j& n4 H, g2 j( T$ }9 x
" o Z$ Z4 Q7 d
# 頛撠鈭斗
& s. l3 f* u7 j0 Q% i6 _. S9 cvm.swappiness = 103 b( r# V' s% Z4 [3 k! X" {
vm.dirty_ratio = 604 S ]! e( s- N8 C8 ~7 J. d
vm.dirty_background_ratio = 28 m6 D" `2 u# o
: s, H) X$ n: W6 X
- P+ h- E, C. M" \9 S0 G( U3 n### 銝祉蝬脰楝摰券賊 ###6 [9 y8 l2 U. m( T
1 N) r' _0 e( H4 F7 n" ?" h9 y, ?2 q" P) Y$ [0 T4 I
# 鋡怠(passive)TCP亦SYNACKs甈⊥5 V& r& ~/ I8 ?6 o+ Z# d* U; U
net.ipv4.tcp_synack_retries = 2
( v" n6 `; g+ r4 t6 c% w! s+ e, S( k1 @
5 N# [. z3 h! M* y5 E5 d# 閮望祆蝬脰楝仿蝭4 ]+ i# n1 m4 q
net.ipv4.ip_local_port_range = 2000 65535+ O& x' I1 V* `. |( _5 l0 x
; V& ]' }% J3 O3 F4 n
9 W* T# @1 Z9 S# 貿CP Time-Wait靽霅* k) W) v$ B3 t( W% r8 s5 z
net.ipv4.tcp_rfc1337 = 1
9 g: B" e& ?9 S4 X1 p! y) i6 X# h
" ?: ~. f8 a* r6 Q
# 雿撠 tcp_fin_timeout connection 閮剖
. `3 N' f- I* K, d1 p. ?net.ipv4.tcp_fin_timeout = 15% T- u$ y( r3 N" A
$ Q0 ]. X- `) r3 `" R% ?
. E$ n: d9 p. Q4 {& K; n9 v
# 雿蝺摮瘣餅閮剖# u" c6 o3 {: L `" l
net.ipv4.tcp_keepalive_time = 300
7 O. q) i4 {3 C9 g( `$ E$ onet.ipv4.tcp_keepalive_probes = 59 G; t$ A. _$ e2 t( J
net.ipv4.tcp_keepalive_intvl = 154 o5 I9 e @! u
: M& n u4 ` o0 b2 G" [
# S1 \# o3 [3 H0 V2 X### 隤踵渡雯頝舀 ###
1 p* e3 n. m+ p/ t7 u, z
- f9 r# R7 Q1 g* I7 x( C ]: x- |8 X! F$ S+ h
# 閮剔Socket交嗥楨摮1 y6 s+ m5 R' F$ }
net.core.rmem_default = 31457280
/ r# Y0 A+ O. @7 W
2 H8 l; ^$ T& C5 i6 V J+ k% [$ b: L3 k* N% x3 }
# 憭抒Socket交嗥楨摮$ W3 j) `9 ~* t: d3 E3 H% I0 E
net.core.rmem_max = 12582912( Q. @! W w t% e. R. \1 ~/ m/ `! V
8 o- K* [" Z$ K5 t& b; v
V8 I0 S) m4 `
# 閮剔Socket喲蝺拙
& p8 L% X/ x' R1 v& x- Z4 enet.core.wmem_default = 314572806 y5 o3 [0 l) v% M( _
4 _1 F* Z9 Z" d" a6 r" u, o2 D+ ?& J" ?# `- B
# 憭抒Socket喲蝺拙
. t9 ^, f5 G4 f0 ^net.core.wmem_max = 12582912
) q3 {8 s& Z% K
9 ]# T5 N3 v4 R- i6 J/ b: V1 x% y1 a# V! F9 h* ^
# 憭抒雯頝舫交: a( j$ O4 O1 _+ b3 ]
net.core.somaxconn = 4096
2 x# I/ G1 W2 L% D% x. J
5 [( c0 H) E8 ^$ }+ v# K9 U8 G. w7 c: ?
# 憭抒雯頝舫亦backlog) j8 z5 g; Z1 R
net.core.netdev_max_backlog = 65536# {7 ?1 J& L9 U9 D$ |1 o5 E; i
: f$ L% p7 t) x* r
8 P/ ^( O; ?& S* C' E- G# 憭扯園蝺拙憭折
; B% T5 W1 W* L- ^" B% v8 z7 ]net.core.optmem_max = 251658243 ~1 [1 z( j5 u [& \/ n+ G: j
1 z- V: X9 @* V0 E
' f s5 }% A* c6 n# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇
: h7 Z' Q( i0 X9 R2 k+ H$ J# This is measured in units of pages (4096 bytes) w6 j. b, k7 Y
net.ipv4.tcp_mem = 65536 131072 262144- Y. }! z2 \+ ~
net.ipv4.udp_mem = 65536 131072 262144
% j% B f% x4 g# W
2 G7 }3 v0 J. `' W" C! n: |- T
) y3 t9 @$ ?5 f0 y8 O* ?0 W& M# 憭扯蝺拙臬蝛粹
! D. N- C4 _' Unet.ipv4.tcp_rmem = 8192 87380 16777216
/ q+ D5 G Y- }1 ~( a( D6 Y# inet.ipv4.udp_rmem_min = 16384
* |0 |3 {( g8 U- n+ K M8 }& H( _( `! d" ~5 n, H! a* `* x& R
3 p8 ^8 Z) H) p# 憭批神亦楨摮臬蝛粹, y3 C* H% o3 u- }
net.ipv4.tcp_wmem = 8192 65536 16777216
. @+ }5 r9 G4 ]$ P3 c) [net.ipv4.udp_wmem_min = 16384; T5 c: a k% \( L
8 n) z3 P0 T4 r' A. @" h9 j \0 s& C
# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅
- O- `) v- E* _1 N" Pnet.ipv4.tcp_max_tw_buckets = 1440000
+ p! A8 \: c- e5 Gnet.ipv4.tcp_tw_recycle = 1
5 }; f) Q' `6 E4 o/ u+ jnet.ipv4.tcp_tw_reuse = 1# ~ ~- `; k. k
' D2 D5 X$ Q6 o7 j- \! z9 y7 G3 M0 f8 C
摮瑼隞亦( a! d4 h. N/ A6 R. O3 _ m
#sysctl -p 頛亙歇霈
8 \3 ^0 y9 N. s$ X) F+ X- [5 w
* p b4 d9 y$ V! }' Y9 ]+ m! h靘皞:
0 |& u' Y X ]6 H. l' o# L3 r9 _4 ~# w
https://easyengine.io/tutorials/linux/sysctl-conf/1 I3 R" y' u' p! R6 B9 v) D: g
摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0
7 G4 O: f( h! L6 h. \7 E% i/ \ R& Q. O P
& v) Z* T$ H# Y/ }! d' {
* ^8 p x, s' g3 v5 d! A5 r |