💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
常见优化参数: ``` shell # 内核优化 ulimit -n 65535 net.core.somaxconn = 262144 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_syncookies = 1 # nginx优化 worker_rlimit_nofile 65535; use epoll; worker_connections 65535; keepalive_timeout 60; ``` 内核优化如何修改: 1、ulimit参数直接运行`ulimit -SHn 65535`即可,可以使用`ulimit -n`查看; 2、其它参数优化示例: `net.core.somaxconn`对应文件`/proc/sys/net/core/somaxconn`: ``` shell # 查看 cat /proc/sys/net/core/somaxconn # 修改 echo 65535 > /proc/sys/net/core/somaxconn ``` `net.ipv4.tcp_tw_recycle`对应文件`/proc/sys/net/ipv4/tcp_tw_recycle`: ``` shell # 查看 cat /proc/sys/net/ipv4/tcp_tw_recycle # 修改 echo 65535 > /proc/sys/net/ipv4/tcp_tw_recycle ``` 3、也可以修改`/etc/sysctl.conf`文件: ``` shell # 调高系统的 IP 以及端口数据限制,从可以接受更多的连接 net.ipv4.ip_local_port_range = 2000 65000 net.ipv4.tcp_window_scaling = 1 # 设置协议栈可以缓存的报文数阀值,超过阀值的报文将被内核丢弃 net.ipv4.tcp_max_syn_backlog = 3240000 # 调高 socket 侦听数阀值 net.core.somaxconn = 3240000 net.ipv4.tcp_max_tw_buckets = 1440000 # 调大 TCP 存储大小 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.tcp_congestion_control = cubic # tcp重新回收 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 ``` 修改配置之后需要执行以下命令使之生效: ``` shell sysctl -p /etc/sysctl.conf ```