性能调优

linux内核优化:
/etc/security/limits.conf
* hard  nofile 391316
* soft  nofile 391316
* nproc soft nproc 391316
* hard  nproc 391316

vi /etc/sysctl.conf
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 1024 65000
vm.overcommit_memory = 1
net.core.somaxconn = 10240
fs.file-max = 391316

echo never > /sys/kernel/mm/transparent_hugepage/enabled

或者
vi /etc/rc.d/rc.local
ulimit -n 102400
ulimit -HSn 102400
sysctl -w net.ipv4.tcp_syncookies=1
sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_timestamps=0
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.ip_local_port_range="1024 65000"
sysctl -w vm.overcommit_memory=1
sysctl -w net.core.somaxconn=262144
sysctl -w net.ipv4.tcp_max_tw_buckets=262144
执行"sysctl -p"使参数生效


mysql 优化:
mysql.d/limits.conf
open_files_limit = 102400

redis 优化:
[Service] centos7
LimitNOFILE=infinity

nginx 优化:
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
#worker_processes  auto;
worker_rlimit_nofile 102400;
events {
  use epoll;
  worker_connections  65535;
}
http{
  keepalive_timeout 300s;
  keepalive_requests 50000;

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  server{
    location /{
      proxy_pass $SERVER_ADDRESS;
      proxy_connect_timeout 75;
      proxy_send_timeout 75;
      proxy_read_timeout 75;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_set_header Host  $Host;
      proxy_set_header x-forwarded-for $remote_addr;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Connection "";
      proxy_set_header Accept-Encoding "";
    }
  }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值