码迷,mamicode.com
首页 > Web开发 > 详细

centos7作为web服务器优化

时间:2016-11-22 15:00:45      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:cookies   live   ipv4   time   swa   web服务   dex   ted   proc   

centos7作为web服务器优化

原文 http://itindex.net/detail/51140-centos7-web-服务器


1、加大打开文件数的限制(open files)

查看

ulimit -n
ulimit -a

vi /etc/security/limits.conf
最后添加

* soft nofile 1024000

* hard nofile 1024000

hadoop - nofile 1024000

hadoop - nproc 1024000

用户进程限制

vi /etc/security/limits.d/20-nproc.conf

#加大普通用户限制 也可以改为unlimited
* soft nproc 40960
root soft nproc unlimited
此步骤需要重启机器生效,可以设置完后再重启

2、网络线程优化

vi /etc/sysctl.conf
加入下面几行

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

# Determines how often to check for stale neighbor entries.
net.ipv4.neigh.default.gc_stale_time=120

# Using arp_announce/arp_ignore to solve the ARP Problem
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce=2
vm.swappiness = 0
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.conf.lo.arp_announce=2


net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30


执行下面命令生效
/sbin/sysctl -p

centos7作为web服务器优化

标签:cookies   live   ipv4   time   swa   web服务   dex   ted   proc   

原文地址:http://www.cnblogs.com/fengjian2016/p/6089298.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!