操作系统设置
vi /etc/security/limits.conf
文件打开数限制,64位服务器上可考虑适当增加该值.
-
- nofile 65536
允许程序core dump全部内容
-
- core unlimited
vi /etc/sysctl.conf
A system-wide limit on
the number of open files for all processes.
一个服务器上有多个需要打开大量文件的应用时,64位服务器上可考虑适当增加该值.
fs.file-max = 65536
#The method of kernel to drop clean caches, dentries and
#inodes from memory, causing that memory to become free.
#1 To free pagecache
#2 To free dentries and
inodes
#3 To free pagecache, dentries and inodes
#The default value is 1.
#为避免频繁的内存磁盘交换,建议将此值设为3.
vm.drop_caches = 3
#这个参数控制内核的脏数据刷新进程pdflush的运行间隔。单位是 1/100 秒。缺省数值是500,也就是 5 秒。
#如果你的系统是持续地写入动作,那么实际上还是降低这个数值比较好,这样可以把尖峰的写操作削平成多次写操
vm.dirty_writeback_centisecs = 100
#这个参数声明Linux内核写缓冲区里面的数据多“旧”了之后,pdflush进程就开始考虑写到磁盘中去。单位是 1/100秒。
#缺省是 3000,也就是 30 秒的数据就算旧了,将会刷新磁盘。
#对于特别重载的写操作来说,这个值适当缩小也是好的,但也不能缩小太多,因为缩小太多也会导致IO提高太快。
vm.dirty_expire_centisecs = 200
#This queue will build up in size when an interface receives packets faster than the kernel can process them.
#If this queue is too small (default is 300),
#we will begin to loose packets at the receiver, rather than on the network.
#对于高清码流,这个参数应该是至少需要调整的
net.core.netdev_max_backlog = 4000
#下面的参数是对所有协议适用的(主要用于UDP),是针对每一个Socket的。
#default socket read buffer, unit: bytes
net.core.rmem_default = 1048576
#maximal socket read buffer, unit: bytes
net.core.rmem_max = 4194304
#default socket write buffer, unit: bytes
net.core.wmem_default = 1048576
#maximal socket write buffer, unit: bytes
net.core.wmem_max = 4194304
net.ipv4.udp_rmem_min = 4096
net.ipv4.udp_wmem_min = 4096
net.ipv4.udp_mem = 774333 1032446 1548666
#下面的参数是TCP协议专用的
#TCP read buffer for each socket, unit: bytes. [min, default, max]
net.ipv4.tcp_rmem = 4096 262144 4194304
#TCP write buffer for each
socket, unit: bytes. [min, default, max]
net.ipv4.tcp_wmem = 4096 262144 4194304
#TCP buffer for all tcp
sockets, unit: pages. [low, pressure, high]
net.ipv4.tcp_mem = 774333 1032446 1548666
net.ipv4.tcp_keepalive_time = 55
net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 10
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1