https://cloud.tencent.com/developer/article/1437197?from=article.detail.1888155&areaSource=106000.5&traceId=en1H1V0Ctjdzz29-luoya
ulimit -n 65535
* hard nofile 100000
* soft nofile 100000
修改完毕之后,调用命令 sysctl -p
使修改立即生效
sh# net.core.wmem_default 发送缓存区预留内存默认大小 默认值 16k
# net.core.rmem_default 接受缓存区预留内存默认大小 默认值 16k
# net.core.wmem_max 发送缓存区预留内存最大值 默认值 128k
# net.core.rmem_max 接受缓存区预留内存最大值 默认值 128k
#
# net.unix.max_dgram_qlen 进程间通信发送数据, 默认10
#
# net.ipv4.tcp_syncookies 只有在内核编译选择CONFIG_SYNCOOKIES时发送作用,当出现syn等待队列出现溢出时像对方发送synccookies,防止syn flood攻击
# net.ipv4.tcp_max_syn_backlogi 送人SYN包的最大请求队列,负载重的服务器增加该值提升接受连接的能力,默认值 1024
# net.ipv4.tcp_synack_retries
# net.ipv4.syn_retries
# net.ipv4.tcp_fin_timeout 如果socket连接由本端关闭,则保持在FIN-WAIT-2状态的时间
# net.ipv4.tcp_keepalive_time 当keepalive起作用的时候,tcp发送keepalive消息的频度,默认2小时
# net.ipv4.tcp_tw_reuse 开启重用 允许将状态为TIME-WAIT的sockets 重新用于新的tcp连接,默认为0(关闭)
# net.ipv4.tcp_tw_recycle 开启tcp连接中TIME-WAIT状态的socket的快速回收,默认0(关闭)
# net.ipv4.ip_local_port_range 用于向外连接的端口范围,默认 32768 61000
# net.ipv4.tcp_max_tw_buckets 表示系统同时保持TIME-WAIT状态的socket连接的最大数量,超过则清除TIME-WAIT状态socket连接,并打印警告信息,默认18000
# net.ipv4.route_max_size 路由缓存最大值
#
kernel.core_pattern=/data/logs/core_files/core-%e-%p-%t
net.core.wmem_default=8388608
net.core.rmem_default=8388608
net.core.wmem_max=16777216
net.core.rmem_max=16777216
net.unix.max_dgram_qlen = 100
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_max_syn_backlog = 81920
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 20000 65000
net.ipv4.tcp_max_tw_buckets = 200000
net.ipv4.route.max_size = 5242880