星期四, 2019-10-03 | Author:
LeeAuthor: Lee
Name: lee
Email: service@i5a6.com
Site: https://www.pomelolee.com/About: webgame网页,手机游戏服务端架构和开发者
| linux, php |
647 views
云主机只有1C1G的内存,既要运行wordpress还要运行一个java程序及mysql,内存实在吃紧,运行1天发现mysql内存不足被杀掉,随优化之。
1.优化mysql参数
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M
2.php-fpm优化,减少php-fpm的数量
配置文件地址:/etc/opt/remi/php70/php-fpm.conf
实际修改配置文件:/etc/opt/remi/php70/php-fpm.d/www.conf
systemctl stop php70-php-fpm.service
pm = dynamic
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
systemctl restart php70-php-fpm.service
~谢谢打赏~
赏