系统调优,保证swoole发挥最大性能

系统调优,保证swoole发挥最大性能

系统ulimit设置

vim   /etc/security/limits.conf
#末尾添加以下代码, 注意,修改limits.conf文件后,需要重启系统生效(reboot重启系统)
* soft nofile 262140
* hard nofile 262140
root soft nofile 262140
root hard nofile 262140
* soft core unlimited
* hard core unlimited
root soft core unlimited
root hard core unlimited

mysql ulimit参数优化

[ubutu系统]
vim /lib/systemd/system/mysql.service  //  增加以下参数
LimitNOFILE=65535
#刷新更改,让生效
systemctl daemon-reload
#重启mysql
service   mysql  restart
[centos系统]
vim /run/systemd/generator.late/mysql.service  //  增加以下参数
LimitNOFILE=65535
#刷新更改,让生效
systemctl daemon-reload
#重启mysql
service   mysql  restart

内核设置

vim  /etc/sysctl.conf
# 文件末尾添加,注意:sysctl -p 使配置生效
net.unix.max_dgram_qlen = 100
net.ipv4.tcp_mem  =   379008       505344  758016
net.ipv4.tcp_wmem = 4096        16384   4194304
net.ipv4.tcp_rmem = 4096          87380   4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
kernel.msgmnb = 4203520
kernel.msgmni = 64
kernel.msgmax = 8192
kernel.core_pattern = /data/core_files/core-%e-%p-%t
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 = 30
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




添加新评论