Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:' q, W* H. \6 L+ }9 ?4 g1 W8 ~
4 q0 [; S: Y, }$ n# A/ T: L
#vi /etc/sysctl.conf
/ e5 t4 V+ r% h, [5 I# S### 寥脩頂蝯梯園蝞∠ ###
& m% J0 u8 t( M6 ^( N9 t) E ^ r, N8 C/ f5 p
% k! c4 G( u' j% S- B* J# 憭扳獢inode敹怠
9 y. V6 u5 o7 d& Ffs.file-max = 2097152
+ x; d& j# V2 i" h+ y( L
: A2 o+ z$ a3 u d, M+ g4 h2 x1 m/ U& G1 {
# 頛撠鈭斗
. o$ h1 W5 G, z1 w$ Y8 a6 p( tvm.swappiness = 10
" T& B# V1 J! Y n% H8 n( _2 s; ~; vvm.dirty_ratio = 60
* `, s" |7 C% Y$ C. X% Yvm.dirty_background_ratio = 2! _7 j9 K' J: z( Q2 O1 X
4 {# q3 I, C* b* z) P" U8 O2 o$ c2 `) w0 l) X }
### 銝祉蝬脰楝摰券賊 ###$ j5 v5 C! F+ M# h4 \: |4 C/ o4 s
. R/ d& ]% ~! \8 }( F1 j' ?( |; N0 U! {3 p$ C
# 鋡怠(passive)TCP亦SYNACKs甈⊥
( i/ w9 o0 o7 y0 M9 W) c0 Snet.ipv4.tcp_synack_retries = 2, \4 ~* D/ h2 F: R
6 `; l5 ?# ]0 M8 q, ?; ]0 k( J
+ y2 K1 I0 |# f2 m5 T- p# 閮望祆蝬脰楝仿蝭+ @( p0 r4 H1 k8 S; @
net.ipv4.ip_local_port_range = 2000 65535; h/ W3 _: H' _. n/ ?
/ [! Q! Y0 |+ Y, Q2 H; j; O
1 C2 ^( M3 |5 D( a/ }. W# 貿CP Time-Wait靽霅
# X4 ? _9 E9 e: k6 M1 w& ]4 lnet.ipv4.tcp_rfc1337 = 1
5 f/ S; o( o) H- c/ O3 F( t" u4 {1 r; D, ]
# r) K# i0 A. y) |9 g# 雿撠 tcp_fin_timeout connection 閮剖
. e0 `$ K4 Q! j# fnet.ipv4.tcp_fin_timeout = 15
) R7 c( Q2 O' g
4 B: q6 [8 H0 l3 t* o; K# p2 v( D' ?! R% z
# 雿蝺摮瘣餅閮剖' k; M7 c- F, ?: V( Y
net.ipv4.tcp_keepalive_time = 300( v, K( k; {4 a) ^
net.ipv4.tcp_keepalive_probes = 5, c {; Z- m6 F+ \" ?7 f: T
net.ipv4.tcp_keepalive_intvl = 15 l8 f5 x S! q+ S7 J4 ~2 ]
6 `( L& l5 A0 d5 |; ]; n S; w( Q' U! M: x" Z# c" V9 P/ x& s
### 隤踵渡雯頝舀 ###
0 d' s% x: Z! U6 ^
3 e) m8 Z$ R5 j- R4 R+ K% I9 h) `! m, ^; M4 n u5 ~ K
# 閮剔Socket交嗥楨摮
+ ]' t Q1 I+ V) {$ E2 Qnet.core.rmem_default = 31457280
* g. W0 F4 I1 @
9 d3 C& ]1 d; l" a/ k3 E4 o0 j6 ^4 C( w5 v
# 憭抒Socket交嗥楨摮7 d, h; f0 W) q Y1 J
net.core.rmem_max = 12582912
3 p- C# ?2 q8 u& u" D4 j& z' g/ G* Y g. m4 {# E
% k( s' c$ c) p4 V+ m" ~' U
# 閮剔Socket喲蝺拙
6 n$ u" S" U* p% Ynet.core.wmem_default = 31457280
; v& S& |. @. m# X4 e
$ r! c2 }' G+ N/ d% i& ?
& q! F+ g# A# S. ]' M$ h% O# 憭抒Socket喲蝺拙
7 B0 j/ y; c7 {7 \7 e5 enet.core.wmem_max = 12582912, J( M" x6 q! U. T( W5 J
% `; M$ [$ H4 p b, J
% R! r5 n9 r+ b: X$ n
# 憭抒雯頝舫交! d& `/ I3 g5 b& m+ W
net.core.somaxconn = 4096
+ f5 S+ a% C! \, L3 j$ D9 n
7 [! x9 g" u) z. O7 p
. v; b5 m( R7 u7 x% z# 憭抒雯頝舫亦backlog
) l& h4 }3 k) i: wnet.core.netdev_max_backlog = 65536
, _1 E1 J3 O1 H+ _2 K* r7 `
3 X+ b( b' M* o1 p7 `% |5 K8 R5 `% P" U
# 憭扯園蝺拙憭折
9 q; E" v O. ?+ A7 ?: gnet.core.optmem_max = 25165824& E% T3 X: [! o
# K y5 m- e- j. S4 q) ]- Y) y0 z) H+ Q" C& d: `3 ^
# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇
6 {; r9 w0 R" V2 J. }# This is measured in units of pages (4096 bytes)
$ U# k1 @8 q0 m9 u. d2 y6 G" R6 }3 _net.ipv4.tcp_mem = 65536 131072 2621448 Y" K' Y7 A, j* a9 I- E
net.ipv4.udp_mem = 65536 131072 262144
* _& Z, t5 Y" T9 w0 {; N
+ J/ F( F' O: A
$ j6 G5 M$ o! o$ T# h# 憭扯蝺拙臬蝛粹
7 C4 f# J4 I! X8 u! Snet.ipv4.tcp_rmem = 8192 87380 16777216
j% h- Z' b% D1 }9 M Dnet.ipv4.udp_rmem_min = 16384' m4 o5 R+ a9 a& C. W1 z' k
8 y) a* D6 b. P! u& S; l
& S( j C4 i0 ^1 y1 V# m8 n* q# 憭批神亦楨摮臬蝛粹
5 z. [; j2 y* L4 U( M J" Vnet.ipv4.tcp_wmem = 8192 65536 16777216
) V, t2 @( Q9 o9 i/ e! R/ c# enet.ipv4.udp_wmem_min = 16384
! ~9 m0 W9 r( j# C& |% g3 R
" h- t7 w3 B& b1 _- s
5 `$ c( b$ e4 F' x u3 Y1 L# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅3 P4 c" K* J. F5 F6 e+ g7 L" x! `
net.ipv4.tcp_max_tw_buckets = 14400004 |! @0 W" U# G) Q
net.ipv4.tcp_tw_recycle = 1
6 ^: ~& v1 E6 ]/ Z0 W' P3 Pnet.ipv4.tcp_tw_reuse = 1# |, v& Y0 ]; s+ }* v# S" n( F
0 B- H" l* r6 @% W6 i; Q" L8 w
: y0 T& {$ L( ~" D p
摮瑼隞亦
4 V; l v( F, E( [4 x#sysctl -p 頛亙歇霈
$ _, h; E8 X: {: r
, }( T; y- ^, W1 s# V9 q靘皞:
( D w6 p3 V% d/ a+ K+ }8 G0 ~, y/ i" [
https://easyengine.io/tutorials/linux/sysctl-conf/
% m) v% N1 N/ w& S( {; B Q摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0 ]* P" i' F J- p* x: z4 V
. ^& Y. i! m1 S+ w, V0 L8 z7 E9 o- B5 S. A
) Z9 r o6 b* A( w |
|