Linux 閮剜舀銝餈啁隤踵,甇斗敹脰雿喳隤踵:
* W( E1 H/ U% v$ P5 z) t
. Y- `3 d6 M$ G#vi /etc/sysctl.conf
$ `$ Q1 l( T8 l### 寥脩頂蝯梯園蝞∠ ###! y# k. ~- j% w% |
/ Y( G9 ^$ {! k+ Z+ O$ g
; v% _; u9 R8 C" V: ^9 b; D; J
# 憭扳獢inode敹怠. |/ n! P2 V. s; k
fs.file-max = 2097152
: f& Y g6 z1 X# T) s
$ n _" T0 ?5 {: C( U, B$ i8 F# B7 `, e
# 頛撠鈭斗
3 f6 i$ u3 \$ G9 dvm.swappiness = 10- P9 X7 w2 `6 v8 P& Z
vm.dirty_ratio = 609 O1 u6 p* t% S8 r/ R% V. I
vm.dirty_background_ratio = 2+ v7 f# j' k2 M# k9 A' {
: [& V0 c+ W: P/ c! E0 l
. q' F5 m/ y- Z9 d$ | n4 @9 D+ b
### 銝祉蝬脰楝摰券賊 ###
3 ~2 ^6 u, i4 Y0 U% Y W* T2 e8 E4 t) [3 c( I; O
& h; y& Z% f# R* ^1 Z# 鋡怠(passive)TCP亦SYNACKs甈⊥0 q5 R, R: m" H( F$ L
net.ipv4.tcp_synack_retries = 2
4 b: m& E* q H7 r6 f; ^. z4 o. o1 H8 O+ {
H7 m" v I2 ^
# 閮望祆蝬脰楝仿蝭
0 [5 |; S( d4 k+ @: I- b& Onet.ipv4.ip_local_port_range = 2000 65535
. j) G( y6 o7 n" ~: l- h) J/ v( f' p4 [ Y& R/ H
/ A$ S& @5 u0 B. w1 M# 貿CP Time-Wait靽霅2 G$ z6 a8 \* P
net.ipv4.tcp_rfc1337 = 1
4 h7 p: \/ M& `; A; B( Q! o
! M* T" U0 w, e0 O- ]2 @
$ S" Y# c8 g5 e, \! _2 m. I+ T+ v$ h# 雿撠 tcp_fin_timeout connection 閮剖' d2 p- }$ w7 R" K, O0 E
net.ipv4.tcp_fin_timeout = 15$ H' U0 e+ y" F+ Z, N& V( ~
0 G/ u9 y- j ~0 H: v Y, p" U9 k+ M1 h. Q) f, n
# 雿蝺摮瘣餅閮剖1 k) Y6 Q# p' I0 V! D5 i
net.ipv4.tcp_keepalive_time = 3008 t2 H5 ]0 i2 G5 k1 L. j. [# k+ e
net.ipv4.tcp_keepalive_probes = 5* K3 z; a2 u/ x0 L0 p D
net.ipv4.tcp_keepalive_intvl = 154 K; v* v$ D" L2 z8 Z" v* Z9 j3 p
' A% {. l) s+ V; ^2 m! [8 T
- c7 R! \8 l3 F### 隤踵渡雯頝舀 ###9 T4 G& t+ ?9 R6 @- `7 ?
+ r9 e4 {4 {6 ` }1 ?
{7 o: O# l/ E0 z4 e1 C
# 閮剔Socket交嗥楨摮$ S' r/ H; k/ Y, F# `/ m2 T
net.core.rmem_default = 314572809 R9 N0 R; E# L# K; _. u' `% B% j$ `
4 a( ] c0 j( k
+ F( O( @) l; ^$ B2 J2 L# 憭抒Socket交嗥楨摮/ }1 x5 |( ~# ^6 z) N; J
net.core.rmem_max = 12582912
6 B; |( n3 {/ P- k7 x
# ], [% Z5 V) A% \$ h
; ?- U! g4 P. x" u, O# 閮剔Socket喲蝺拙
5 y# _$ i7 F! z3 inet.core.wmem_default = 31457280
6 l' s+ ~; E5 Y' J3 G# @8 s
: F, |6 f5 e; a9 L- I8 U% k$ R0 E; m( {9 p! q5 s C
# 憭抒Socket喲蝺拙
0 C/ I4 F) _0 i1 R" e0 m# ?* m, inet.core.wmem_max = 12582912. n- ~, c) K8 o A* g! T& c
+ |& v/ O K$ `7 B8 v* }% }# j, _/ ^; Y% @$ `6 E0 E' c/ x2 o
# 憭抒雯頝舫交5 Z! F$ c' I' v( ?" a( Z, R
net.core.somaxconn = 4096
6 V( T9 m# m1 M7 y, f( p+ I& L7 H ?# |3 @, ~
0 R7 D4 H4 |% y" B. d0 j6 G( p0 ?# 憭抒雯頝舫亦backlog
& i9 x& X% ~0 ^5 t, r* onet.core.netdev_max_backlog = 65536
7 ?4 ?( j& n8 ~( `& I) `1 a( v. V, W! S0 x; Y& r, e' c4 V
0 g: _3 E5 [% P4 g2 d- A: `
# 憭扯園蝺拙憭折
. c- @3 ?* h# n/ J6 Nnet.core.optmem_max = 25165824
$ L8 Y: R' u" w: S8 g. b8 K# ^$ G! a9 z6 V2 `
- c/ q/ d$ Z0 c& ^3 D
# Increase the maximum total buffer-space allocatable憭批臬蝺拙蝛粹憭抒蜇
& n) \ k- k9 a( e j" M1 T) s# This is measured in units of pages (4096 bytes)
7 @! w: E4 @$ Xnet.ipv4.tcp_mem = 65536 131072 2621443 H0 k0 _* s% Z- H, E3 W" s
net.ipv4.udp_mem = 65536 131072 262144
/ E: |* |4 X, n, d* W
1 }* l1 y. b, m5 |9 v* o% `; t0 {! v6 l
# 憭扯蝺拙臬蝛粹$ \3 l7 d8 q) a2 S7 ]
net.ipv4.tcp_rmem = 8192 87380 16777216) F: c& f2 B& D9 _7 j
net.ipv4.udp_rmem_min = 16384
- a7 N8 p! G$ P- g# T1 v& @" d& v( I7 b: n/ d$ _; J
) M8 N* T: U) u) h4 }: {- `
# 憭批神亦楨摮臬蝛粹
; M* R$ A, x9 s& X7 }( k Rnet.ipv4.tcp_wmem = 8192 65536 16777216' E/ n* h0 D: Z$ N5 ~; s' x- i
net.ipv4.udp_wmem_min = 16384
# c8 g4 `, C3 d0 N7 m( A3 H3 v% R# k9 x3 j# c! y
7 k, Q% ?) n+ @# u- g# 憭含cp-time-wait獢嗅瘙賊隞仿脩陛DOS餅7 ~* x& V8 ? ^) g2 q, R4 l. y
net.ipv4.tcp_max_tw_buckets = 1440000
; F+ J$ L6 z0 @( e6 Tnet.ipv4.tcp_tw_recycle = 1/ f* C1 y6 O! v3 N
net.ipv4.tcp_tw_reuse = 15 P: s" B6 ^# @: H
" p+ V* e( J- y; a2 G
! |% R) I# e# O& L+ X) d
摮瑼隞亦' ~, B8 R" o1 _8 K$ u
#sysctl -p 頛亙歇霈3 z' h5 H4 C* |3 j- j [5 O% v
" x2 d7 d; l) d) I# f$ _% m靘皞:+ P( j4 y* n0 B5 S# m1 `
% A0 Y4 f# A. \& {% m" ?8 v6 _
https://easyengine.io/tutorials/linux/sysctl-conf/# N! A* G( l/ I5 D+ s9 s; _
摰g砍梯批捆閬蝛擃 888999999999 舐閬踝函嗅蝛 0
# Q* y5 W: o. c$ I2 I% M2 _) Z- W+ B2 `& @8 y
+ n L) i! \5 V W% H! m4 L& ]) r& S* K8 ]% e' I. m
|
|