Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:7 e: O( Z! v1 t* x
8 w$ ]' g, E- [0 b7 ^1 m
#vi /etc/sysctl.conf
2 p8 I0 F) r* h/ Z$ M; I; F### 寥脩頂蝯梯園蝞∠ ###
- c8 i% k6 z$ I7 Q2 \
3 f, E& j0 x- L" I1 q( W: G0 Z( f- m% A6 r o- B
# 憭扳獢inode敹怠/ y* ?" d0 P; q+ h9 a1 K& N
fs.file-max = 2097152
6 K- M+ ^0 [. A l$ r; i% J
/ m6 T" M5 v1 N& h2 V F5 G% ~, h. x% x2 o" F
# 頛撠鈭斗$ h* d9 F( s! t5 }6 e' I2 n
vm.swappiness = 106 y }" g7 a" q" B
vm.dirty_ratio = 60
6 x0 s8 x9 `( z. j+ Z( X0 H4 vvm.dirty_background_ratio = 27 C$ W- L0 a7 f" Q$ f; }1 v, i
5 T; ?( ]& C3 F" k
4 P5 w2 V1 s- k, a- H. A/ v### 銝祉蝬脰楝摰券賊 ###. r# L+ Z. P1 a- G
# H" T( ~9 L) I) P- w8 S
5 D2 m7 |, A- S/ p) p5 e
# 鋡怠(passive)TCP亦SYNACKs甈⊥, B" R u6 [$ v' _
net.ipv4.tcp_synack_retries = 2% X+ h/ l% t/ F3 C. F. ?
8 g1 S9 z* r! x* Z% D& e i: J: r% G$ D9 s' w! D" r. z) o. c+ b
# 閮望祆蝬脰楝仿蝭
8 L/ J+ C, Q1 b9 B8 q1 g6 ]* fnet.ipv4.ip_local_port_range = 2000 65535) j& q) F; ] B/ k0 [+ ]; C& h
4 N, F1 ?5 Z2 h# I1 m- T: O9 {% L
5 h* k7 i: |; X, G' N$ ]& P9 w# 貿CP Time-Wait靽霅
& U; d( B1 i+ ?+ K, |" Anet.ipv4.tcp_rfc1337 = 1
3 z; T& Z& v9 G, t' \! \ B/ g
/ Y4 I! G9 [: {5 q. _9 z5 O1 g( [1 K
# 雿撠 tcp_fin_timeout connection 閮剖
0 ]9 C7 K% Y" s2 l9 d1 O: A2 hnet.ipv4.tcp_fin_timeout = 15" Y; Q2 D, j! S; i2 J5 T, F8 O! B
. s0 G A7 B) n0 P
% u; b+ r: a8 Y$ a& [ {' {: ?# 雿蝺摮瘣餅閮剖 q$ p! O' L9 N% |$ g% Q
net.ipv4.tcp_keepalive_time = 300- z9 y% d1 C9 k8 B9 m
net.ipv4.tcp_keepalive_probes = 5
0 h1 _/ ?$ V. \% S# }net.ipv4.tcp_keepalive_intvl = 15
4 X9 j9 G7 q& q% f( s# ]& I5 K7 h# n7 B Q
: c; d. V5 D+ s, ^% E S2 ?3 W
### 隤踵渡雯頝舀 ###
+ `, J3 o. I' B6 P4 g0 _! C/ I& x2 b/ C6 b, D+ I
+ Z$ I" [/ @$ M! r5 d6 w7 w6 t# 閮剔Socket交嗥楨摮9 L$ r$ a* v* S4 `. T+ s
net.core.rmem_default = 31457280
1 u$ Y2 B5 t1 @6 U( C9 U( P
+ ?5 o0 k( s f4 U3 y; ^) ~. G3 Y1 l. E
# 憭抒Socket交嗥楨摮. Y3 w( L# P# N2 Z
net.core.rmem_max = 125829122 S' C8 Z( @: i7 W; m. w8 w& r
/ t5 q* a$ K/ r% K1 W) d* Z; J
7 ?5 N+ {' b( ]) M, v
# 閮剔Socket喲蝺拙
/ L! h2 D" b. |4 C$ |net.core.wmem_default = 31457280% f4 g6 J, z- T! L
" c3 }6 ?) d5 q0 ?2 A! c
$ u9 g8 F0 I* J% x* \* v& y# 憭抒Socket喲蝺拙5 ?/ d- \; P5 M
net.core.wmem_max = 12582912$ c: o, v* x- p2 K2 A
9 _- j! Z5 _9 X* n/ G d% l+ e* @& o5 G! g1 e
# 憭抒雯頝舫交
" ]6 g4 w% `( u- N5 anet.core.somaxconn = 4096
2 R Z8 m1 b- L$ t5 {3 x) ?" J1 O ]0 L* \+ a7 M, r& ~. g7 n. ?9 f
; t' a) T4 v/ O$ d5 h
# 憭抒雯頝舫亦backlog
l9 `, b- t8 X$ \) p' a/ Anet.core.netdev_max_backlog = 65536
/ W8 h) @1 n/ n, V6 s" w/ {" a( C+ o7 q" s7 E2 A
, n$ e, |& J$ h) @9 c. D, h
# 憭扯園蝺拙憭折2 @0 t' M, y& Q: H/ |" P
net.core.optmem_max = 25165824
$ x% l% l" k& Y# N1 Q: S2 Q2 f" F7 _& F" m3 I0 h# u
! u3 g2 @; R* t9 m: [% _# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇
% Y: U2 ]& P& h2 @! {# This is measured in units of pages (4096 bytes)
9 g$ B5 I# Q C5 T% ]! {) nnet.ipv4.tcp_mem = 65536 131072 262144
% z! z1 r/ Q0 |4 n* }& o) A8 @8 j1 \net.ipv4.udp_mem = 65536 131072 2621444 h) B3 |( @3 f: \. R
2 o7 j+ i P5 a9 e4 i% b9 o- P
4 c1 J' u* Y1 q, C( Y' @* i# 憭扯蝺拙臬蝛粹
0 ], S- M3 r' F# {8 C0 o+ R( r% [net.ipv4.tcp_rmem = 8192 87380 16777216
$ a2 z9 @2 ~1 lnet.ipv4.udp_rmem_min = 16384
9 y) h2 c: Y% I5 i y
4 I5 S9 }% C+ k- R" t$ ], d8 m1 L8 z: Z# S9 a b
# 憭批神亦楨摮臬蝛粹
' p d# V7 p; ?# c I2 C+ o" hnet.ipv4.tcp_wmem = 8192 65536 16777216
; q" g! }5 ^6 ^6 e/ {net.ipv4.udp_wmem_min = 16384
3 E0 Q& b0 T1 b; K6 M4 \/ Y5 Z% h& l, s( S4 v# x3 u" f
. F) M$ W0 o# Z; U) N) i: a# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅! n1 z b- y/ F8 b
net.ipv4.tcp_max_tw_buckets = 1440000
( Y9 h+ W7 j2 hnet.ipv4.tcp_tw_recycle = 19 E. ]& t* o. ?! R2 v! j1 v
net.ipv4.tcp_tw_reuse = 1, m2 x" j- h1 p
% i) Z- `* g7 p5 W* E1 `
?) Y4 s" Z/ i4 W0 C* P/ {
摮瑼隞亦. J. T. V; _/ `+ a# n
#sysctl -p 頛亙歇霈
' I3 |: v! f% c: u
: v! |6 Q3 S! s- |* i: R靘皞:. ^- q% [& |- v
; F4 A u' p' D. ~, R7 I" shttps://easyengine.io/tutorials/linux/sysctl-conf/
; m L/ E7 k6 E/ U; m摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0 $ [; y; Z# j3 V$ b, N- h: c
+ d+ k. a) m6 c% x
% C8 z( ]2 O8 q- ^: O( ^
2 }* U; L0 v$ m5 u5 O/ r! w |
|