linux系统优化

linux 实战性调整优化

1:ubuntu修改软件仓库:

阿⾥云仓库地址:https://developer.aliyun.com/mirror # 修改此仓库,参看网站介绍。
手动vim /etc/apt/sources.list 清空 替换相应版本的配置。执行apt update更新仓库
中科⼤:http://mirrors.ustc.edu.cn/help/ubuntu.html
清华⼤学:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
华为:https://mirrors.huaweicloud.com/

2. 系统资源限制优化:

#cat /etc/security/limits.conf # 复制到文章内容最下方
#root账⼾的资源软限制和硬限制
root 	soft 	core 		unlimited
root 	hard 	core 		unlimited
root 	soft 	nproc 		1000000
root 	hard 	nproc 		1000000
root 	soft 	nofile 		1000000
root 	hard 	nofile 		1000000
root 	soft 	memlock 	32000
root 	hard 	memlock 	32000
root 	soft 	msgqueue	 8192000
root 	hard 	msgqueue 	8192000
#其他账⼾的资源软限制和硬限制
* 	soft 	core 		unlimited
* 	hard 	core 		unlimited
* 	soft 	nproc 		1000000
* 	hard 	nproc 		1000000
* 	soft 	nofile  	1000000
* 	hard 	nofile   	1000000
* 	soft 	memlock  	32000
* 	hard 	memlock  	32000
* 	soft 	msgqueue 	8192000
* 	hard 	msgqueue 	8192000

3. 内核参数优化:

sudo vim /etc/sysctl.conf #文章内的全部内容用以下内容覆盖

# # Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
# TCP kernel paramater
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
# socket buffer
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 20480
net.core.optmem_max = 81920
# TCP conn
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 15
# tcp conn reuse
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_max_tw_buckets = 20000
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syncookies = 1
# keepalive conn
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.ip_local_port_range = 10001 65000
# swap
vm.overcommit_memory = 0
vm.swappiness = 10
#net.ipv4.conf.eth1.rp_filter = 0
#net.ipv4.conf.lo.arp_ignore = 1
#net.ipv4.conf.lo.arp_announce = 2
#net.ipv4.conf.all.arp_ignore = 1
#net.ipv4.conf.all.arp_announce = 2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值