技巧:安装linux后的内核调优

系统 Linux
此技巧对于Squid,效果却不大。此项参数可以控制TIME_WAIT套接字的最大数量,避免Squid服务器被大量的TIME_WAIT套接字拖死。

安装linux后的内核调优

kernel.shmall = 268435456

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_fin_timeout = 30

net.ipv4.tcp_keepalive_time = 1200

net.ipv4.ip_local_port_range = 1024 65000

net.ipv4.tcp_max_tw_buckets = 5000

net.ipv4.tcp_max_tw_buckets = 5000

net.ipv4.tcp_fin_timeout = 30

net.ipv4.tcp_keepalive_time = 300

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 1

net.ipv4.ip_local_port_range = 5000 65000

net.ipv4.tcp_mem = 786432 1048576 1572864

net.core.wmem_max = 873200

net.core.rmem_max = 873200

net.ipv4.tcp_wmem = 8192 436600 873200

net.ipv4.tcp_rmem = 32768 436600 873200

net.core.somaxconn = 256

net.core.netdev_max_backlog = 1000

net.ipv4.tcp_max_syn_backlog = 2048

net.ipv4.tcp_retries2 = 5

net.ipv4.tcp_keepalive_time = 500

net.ipv4.tcp_keepalive_intvl = 30

net.ipv4.tcp_keepalive_probes = 3

net.ipv4.conf.lo.arp_ignore = 0

net.ipv4.conf.lo.arp_announce = 0

net.ipv4.conf.all.arp_ignore = 0

net.ipv4.conf.all.arp_announce = 0

几个解释:

net.ipv4.tcp_syncookies = 1

#p#

#表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;

net.ipv4.tcp_tw_reuse = 1

#表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;

net.ipv4.tcp_tw_recycle = 1

#表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。

net.ipv4.tcp_fin_timeout = 30

#表示如果套接字由本端要求关闭,这个参数决定了它保持在FIN-WAIT-2状态的时间。

net.ipv4.tcp_keepalive_time = 1200

#表示当keepalive起用的时候,TCP发送keepalive消息的频度。缺省是2小时,改为20分钟。

net.ipv4.ip_local_port_range = 1024 65000

#表示用于向外连接的端口范围。缺省情况下很小:32768到61000,改为1024到65000。

net.ipv4.tcp_max_tw_buckets = 5000

#表示系统同时保持TIME_WAIT套接字的最大数量,如果超过这个数字,

#TIME_WAIT套接字将立刻被清除并打印警告信息。默认为180000,改为5000。

#对于Apache、Nginx等服务器,上几行的参数可以很好地减少TIME_WAIT套接字数量,

#但是对于Squid,效果却不大。此项参数可以控制TIME_WAIT套接字的最大数量,避免Squid服务器被大量的TIME_WAIT套接字拖死。

【编辑推荐】

  1. Linux下反弹CmdLine Shell小技巧
  2. Linux下处理图像的法宝GIMP的安装
  3. Linux中防御垃圾邮件的方法
责任编辑:赵宁宁 来源: IT专家网
相关推荐

2022-01-27 23:32:03

Linux操作系统TCP

2011-03-18 11:21:48

2010-09-26 09:08:17

JVM调优

2013-08-27 13:44:14

MySQL调优技巧

2010-09-25 15:52:27

JVM内存JVM

2010-09-25 13:05:07

JVM参数

2023-02-07 08:00:00

MySQL数据库技巧

2022-01-28 15:44:00

Linux服务器技巧

2017-11-17 08:56:59

Java性能优化技巧

2022-11-30 08:17:41

JVM调优技巧

2010-09-17 17:02:24

JVM参数

2011-03-10 14:40:54

LAMPMysql

2012-01-10 14:35:08

JavaJVM

2020-12-30 15:06:39

开发技能代码

2017-12-08 11:28:58

MySQL性能调优技巧

2017-07-21 08:55:13

TomcatJVM容器

2013-03-20 17:30:18

2011-03-31 13:40:34

2011-05-20 11:11:13

2021-03-04 08:39:21

SparkRDD调优
点赞
收藏

51CTO技术栈公众号