Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:
" K* b& |7 e4 J1 G! T% g# O
. C: e/ t, R$ I) o6 K1 A: T) F y0 A5 n% @#vi /etc/sysctl.conf
' L4 F% ^5 K% F" ]; \$ M* a### 寥脩頂蝯梯園蝞∠ ###
3 p0 Q( p. c/ x% |6 \
( |% o1 p# l! N' a, x+ `1 c
. ?4 Y8 l, ~, N# U# 憭扳獢inode敹怠/ z$ |, v/ I1 ]# i+ v8 p
fs.file-max = 2097152( X$ z5 s+ u/ C+ g! l2 I
) K2 g2 z, K9 I4 f
7 b" q8 C5 R6 t0 x' ]0 C5 [
# 頛撠鈭斗2 ^5 ]# j- `7 H
vm.swappiness = 10
) m# ]. p; X0 p& nvm.dirty_ratio = 60# e6 a! a6 X4 k+ q0 A
vm.dirty_background_ratio = 2
; ]2 G) m4 U; a4 s% [. I& @
( U* ]1 c; @; J" n# H
: t6 g, X: E$ t4 c6 c0 |, N P; P### 銝祉蝬脰楝摰券賊 ###
: t8 }6 @. r6 G; }/ c& M0 b" ~: g% A
+ x7 c% v. K: I# c$ x
# 鋡怠(passive)TCP亦SYNACKs甈⊥
) I$ H$ ~8 ]" A6 Lnet.ipv4.tcp_synack_retries = 2
; o- N( a, ~- M; ]* i! }. a
$ d; i. f$ U2 g( u/ I. h3 M# e' n6 {
# 閮望祆蝬脰楝仿蝭/ g) |8 e8 C( L% p6 k8 m: S
net.ipv4.ip_local_port_range = 2000 65535
/ }2 b8 r% I+ c% M% U: R
5 s& n0 X3 H* W/ r9 |* \+ F
( ?" H& R Q( Y9 l6 R; T# 貿CP Time-Wait靽霅7 U! n( [; E) F$ o# f- s! f
net.ipv4.tcp_rfc1337 = 1
* H! M4 g% g% I8 v0 s' _7 F0 C% ?' H7 |6 w# G( M C3 L/ }( T9 _9 W; m
, W* d7 r" u, N% V2 U1 w
# 雿撠 tcp_fin_timeout connection 閮剖* J% d; i! L8 L
net.ipv4.tcp_fin_timeout = 15, T/ M' r; U& J0 S9 k
6 z% K/ B4 l. G& A2 x
: _5 f* q% T4 ?# 雿蝺摮瘣餅閮剖& h: i' ]2 S7 W3 G5 A! t
net.ipv4.tcp_keepalive_time = 300
3 a, {9 Z: ^2 w: z4 ynet.ipv4.tcp_keepalive_probes = 50 l" w- i4 O6 ^% s+ z9 W
net.ipv4.tcp_keepalive_intvl = 15
9 b/ i' G9 b3 n: |' b0 T& z5 w" r
2 F3 s3 J5 B# f: ~4 j. Z% s) j- A6 }9 O
### 隤踵渡雯頝舀 ###
1 n; j5 a- T6 v0 K/ I5 H1 k
% z1 F9 q% K/ t8 Q8 F0 r6 q g+ g; v% R1 Q
# 閮剔Socket交嗥楨摮/ p# S, W7 }: T3 @
net.core.rmem_default = 31457280( n: H2 u0 d) z
8 s! C% y! n: Z- i$ @
( L' F" A" h! K4 Y; D5 s( M
# 憭抒Socket交嗥楨摮& d' P! z/ s) ^" C
net.core.rmem_max = 12582912; B' ?; \8 e1 Y$ y: G2 O
( x. N( v4 b h& z9 c& |* L& f7 v+ L a
# 閮剔Socket喲蝺拙
2 S7 Y6 {8 }+ k8 @# Lnet.core.wmem_default = 31457280) T4 J( l+ i0 w$ P! v2 y9 ^4 Q
; q) }2 U. F. R: D$ V4 U% @2 l6 v8 Q. z; q
# 憭抒Socket喲蝺拙
& A. M) h. L! W3 w$ enet.core.wmem_max = 12582912
0 |. U) g( Q9 a Y! @& a' N. J" B! S, O! [
+ t: U: \. x5 F' \# 憭抒雯頝舫交
9 j& ^* \6 O$ rnet.core.somaxconn = 4096
; Q; M* m4 o7 U) C" V" |8 B# T" m5 M9 x9 t$ F
& h( a1 N2 Q; M3 m3 B5 J
# 憭抒雯頝舫亦backlog
1 t/ X; V8 s- \8 M) tnet.core.netdev_max_backlog = 655364 F$ m% }. a: D9 y0 P; N- a
4 t8 ^# j: [$ E/ a! X7 [6 y5 b' R7 E/ q0 n/ j8 {. C7 s
# 憭扯園蝺拙憭折
0 v5 e! Z, }, C! Onet.core.optmem_max = 25165824
& _! O/ N4 O g; F' G5 _% c& d/ V
0 ?& G+ ]' { X( s5 j G4 c# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇+ b9 ~' Y5 x6 b$ u
# This is measured in units of pages (4096 bytes)! c* s* r! Q( \3 [. ]5 C
net.ipv4.tcp_mem = 65536 131072 2621442 f! [6 `: b' N2 p- C" M8 t
net.ipv4.udp_mem = 65536 131072 262144" o: f% Q; J9 M3 F
+ E$ P% T$ w! D
. W2 H* r* W5 F" Y# 憭扯蝺拙臬蝛粹
9 K9 C! O( _$ {- q; D# j" ^net.ipv4.tcp_rmem = 8192 87380 16777216
- m" w% B: X, F2 M, t- D; [5 ?) Nnet.ipv4.udp_rmem_min = 16384
1 f; r2 M! E1 t/ P) y. x8 @. G0 V6 @- D
- V: f, ~ W, [* \# 憭批神亦楨摮臬蝛粹
& ]! Y# u8 I/ |% O7 g: o) ^net.ipv4.tcp_wmem = 8192 65536 16777216
6 X- e5 n9 I* M5 Z1 ^& Ynet.ipv4.udp_wmem_min = 16384% y$ m. c* s8 R# N6 ^& u
5 e; m' H! C* O% Q) q2 ?( L+ \
0 `- i1 ~9 w8 p! _! y5 f) Q# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅
2 o; T$ O, {5 z+ rnet.ipv4.tcp_max_tw_buckets = 1440000$ m$ Q$ N/ o+ d5 p
net.ipv4.tcp_tw_recycle = 1* Y: v8 A6 o4 N( r: _
net.ipv4.tcp_tw_reuse = 1
5 @" Y7 a! {% b% Q$ u: O3 h" M# y- D% X
" C0 p, }' M! i3 A! _摮瑼隞亦
0 N8 g. J! k% ~; O8 p#sysctl -p 頛亙歇霈
Q, C, @! `& G" t$ l. R0 o; k% ^7 T* t5 L
靘皞:7 v( \: `& b& L3 q9 T
, `/ R5 R9 z; d; Yhttps://easyengine.io/tutorials/linux/sysctl-conf/8 S* |, t J" H; t0 e |0 p. Y8 \
摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0 6 F# j5 u! S M( q- n
. e4 }% m7 C& \; f2 V6 M5 E- e' R; `$ B$ `3 h
. U, }4 g! O. v |
|