我正在使用 Bitnami 在 AWS EC2 t3a.medium (4Gb Ram) 实例上运行 WordPress 网站。服务器的 RAM 经常被完全填满,导致服务器崩溃,我需要从 ec2 控制台重新启动它。
我研究了调整我的 php-fpm 设置来缓解这个问题。
这是当前的配置:
opt/bitnami/php/etc$ cat memory.conf
pm.max_children = 47
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 30
pm.max_requests = 2500
MariaDB配置文件:
[mysqladmin]
user=****************
[mysqld]
skip_name_resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
port=3306
tmpdir=/opt/bitnami/mariadb/tmp
socket=/opt/bitnami/mariadb/tmp/mysql.sock
pid_file=/opt/bitnami/mariadb/tmp/mysqld.pid
max_allowed_packet=16M
bind_address=127.0.0.1
log_error=/opt/bitnami/mariadb/logs/mysqld.log
slow_query_log=1
slow_query_log_file=/opt/bitnami/mariadb/logs/mysqld_slowquery.log
long_query_time=10.0
character_set_server=utf8
collation_server=utf8_general_ci
plugin_dir=/opt/bitnami/mariadb/lib/plugin
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default_character_set=utf8
plugin_dir=/opt/bitnami/mariadb/lib/plugin
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
pid_file=/opt/bitnami/mariadb/tmp/mysqld.pid
!include /opt/bitnami/mariadb/conf/bitnami/memory.conf
内存.conf:
long_query_time = 1
query_cache_limit=2M
query_cache_type=1
query_cache_size=128M
innodb_buffer_pool_size=256M
/opt/bitnami/mariadb/logs/mysqld_slowquery.log:https://pastebin.com/ZVecqAXp _