Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:# B S5 v3 G# }/ k0 D, U
4 a% C2 r9 S7 E#vi /etc/sysctl.conf" R* y r: c$ u6 c7 [& _/ c8 E7 x/ |
### 寥脩頂蝯梯園蝞∠ ###; [7 t& @2 G* i% u
3 c8 q5 I8 |) f# K" d
2 G5 m o5 F: l4 Q+ B* A
# 憭扳獢inode敹怠( N( l, w- |' o4 o; @4 @
fs.file-max = 2097152
) _* k0 Q+ K- `
" w8 U: q, u6 ?& `6 ^ f# f0 u% g
3 W4 N+ J3 v4 X6 G5 d% D4 `# 頛撠鈭斗
, ]7 o8 x( r7 y. H% Nvm.swappiness = 10
2 X: \8 h# x" I" kvm.dirty_ratio = 60
+ K# A! g1 [3 Z+ c( B b( avm.dirty_background_ratio = 2# b7 B+ C+ K, n" Y
- k4 A# o( F% c5 R- P( ]- a* a6 ?0 S6 f
### 銝祉蝬脰楝摰券賊 ### Y- @: S9 l% V$ d9 r8 G" ]* y" Y
: m/ X# I8 s0 J: o! o% ?1 W" v, F
% m( p2 J9 B c5 {) a9 {3 ^. k
# 鋡怠(passive)TCP亦SYNACKs甈⊥
" B3 }- K( N& ]: y. ~net.ipv4.tcp_synack_retries = 28 ^8 \& ~) l9 f2 I# V# k5 R0 V: U% [" J/ o
/ \1 d" T2 j, d9 T0 Q
' K. e3 d- s! E4 a, f# 閮望祆蝬脰楝仿蝭0 Y w: }, q* ~5 |3 w
net.ipv4.ip_local_port_range = 2000 65535) g* p' T' l8 V
2 `: f+ e3 t G( J
0 h1 ]8 o. J. Y4 E6 Y6 a( @4 e# 貿CP Time-Wait靽霅/ R& p; h K+ v% M( R
net.ipv4.tcp_rfc1337 = 1
. S. @; j- f9 |" e4 }. E
J u* f. z+ G k1 O( Q n* d7 {6 n% c2 ~3 D- l
# 雿撠 tcp_fin_timeout connection 閮剖
! [/ o2 J6 A% R6 J) Q) wnet.ipv4.tcp_fin_timeout = 151 w% y( `3 Q! k% q4 v: J
; S7 N/ X' V& @: c$ V s, j. S$ K
/ J8 n; \& e9 B/ i; D$ k! r& A3 i
# 雿蝺摮瘣餅閮剖7 _2 w- t- b0 l# a. I
net.ipv4.tcp_keepalive_time = 300
# e8 Y9 S& i( e4 E* ^* e7 Anet.ipv4.tcp_keepalive_probes = 5) ^0 E7 i# L8 R. t3 q E
net.ipv4.tcp_keepalive_intvl = 15
: T# k! K/ g1 G% N/ b& F% S1 e
" @ ^: n1 v0 ?: `1 K
4 E& b( y+ M) c9 G; |) P/ V### 隤踵渡雯頝舀 ###
) V6 ?; Q6 n2 [- P6 t, p2 ]3 l
* W5 L9 d b, T! c/ U0 _ ^# 閮剔Socket交嗥楨摮
8 U7 V7 l$ Z, Y [6 hnet.core.rmem_default = 31457280
2 E. k+ v8 \7 ^" M
# F" |6 _+ E/ h" Z1 p; l- _4 Y1 u4 i# h0 k6 G0 k
# 憭抒Socket交嗥楨摮8 y% ~ _4 g/ p6 @, F7 A N
net.core.rmem_max = 125829124 F2 V2 j9 O- A- Z' U+ D
1 Q& y% [/ b2 U) T2 ?
6 v* B* ?* s: Q3 b, o# 閮剔Socket喲蝺拙/ T9 t8 S) R g* p0 B& W
net.core.wmem_default = 314572805 o4 n' P7 \( [( j+ s
6 {8 f* Q) ]* I0 O5 n
5 f- h: O: n! c+ n. V+ A# 憭抒Socket喲蝺拙
, z( C, ^8 ?& P; ]/ O6 |* d8 Qnet.core.wmem_max = 125829126 L! o/ X6 a J3 G7 i9 g5 z
( t. h+ f# A z4 n( G" u$ ?! a3 ?7 f3 M1 t, L
# 憭抒雯頝舫交+ D5 m! b2 |, P% r" F/ o1 D6 g
net.core.somaxconn = 4096
- l* I4 s/ N6 P- q) G, i
1 Q, ~6 @! e6 e8 Q% s h
1 [/ y" q: F4 U+ Q* G3 X# 憭抒雯頝舫亦backlog
$ y6 c! m3 m8 mnet.core.netdev_max_backlog = 65536
2 d$ B) F3 }8 m% l0 ^7 V @% @
1 q5 m* u2 w+ y; ~5 x
" V& F0 z% B7 T) b, l% ~$ R# 憭扯園蝺拙憭折
i$ c O) h" I. x0 v7 Lnet.core.optmem_max = 25165824- M" h* C( ` H
) k& g8 M3 ]+ H& u
4 \6 n. j2 I0 m& z
# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇3 g$ O& I" A1 z
# This is measured in units of pages (4096 bytes)7 m- e, J2 y; J
net.ipv4.tcp_mem = 65536 131072 262144) q- I5 |( b$ {- u& i$ z# N3 B* ~
net.ipv4.udp_mem = 65536 131072 262144
1 N/ ] h+ X/ w' j+ |0 G) ^7 C1 `! y g! y/ T! {1 _
# Z6 G& G7 r9 N4 ]# 憭扯蝺拙臬蝛粹
# F* y, E4 g5 K) [net.ipv4.tcp_rmem = 8192 87380 16777216$ C( y6 L( f/ ~; \/ C. x5 i |* H
net.ipv4.udp_rmem_min = 16384
# k2 h, J* i& m+ }( N% o# U! R
1 a, a& Z' b9 ^& e
% l" |8 o/ W2 F# 憭批神亦楨摮臬蝛粹/ k- T- Y' F/ Y8 B) v3 q
net.ipv4.tcp_wmem = 8192 65536 167772165 r$ \9 V1 q0 S9 i, D5 j0 ~. q5 Z- [
net.ipv4.udp_wmem_min = 163840 l3 M9 o/ k% n( ]( ?; s8 N# b
$ p) G& x5 C# ^0 Y! X, ]' X- Q
. ]1 R$ S# Z6 s0 I
# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅, w1 X8 u6 F% y* `
net.ipv4.tcp_max_tw_buckets = 1440000
2 N" ^& u2 T$ E# b7 t% S7 qnet.ipv4.tcp_tw_recycle = 1
6 H! k4 \- o2 ^8 anet.ipv4.tcp_tw_reuse = 1
9 A, |* O# ^; n! ^, z
% L3 X8 a. D Q/ a
8 O+ x7 |4 y4 a* }. o摮瑼隞亦4 R/ l* @( x# n" G8 e4 y! h
#sysctl -p 頛亙歇霈
' I) f5 R/ D3 X* c9 n8 g. P
4 {. K: A0 z$ V" i靘皞:
, Z+ N, N1 r" A! p2 ~& Y( e& d. h
" Q% K% f S* D9 A- }* ]https://easyengine.io/tutorials/linux/sysctl-conf/
1 C6 v( ?3 [3 A摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0
" r; P" M; a- k6 `7 w
5 T5 w# Q( N A
; M2 N* u$ m( k( ]0 H [9 \- c/ r3 K( ]
|
|