折腾:
【已解决】给Linode中的LNMP的crifan.com优化内存占用
期间,
去看看,能否通过mysql,去继续降低页面加载时的内存占用,低至10M左右。
然后去看了mysql的配置,有些不一样:
fzhost的多了:
performance_schema_max_table_instances = 500 explicit_defaults_for_timestamp = true |
但少了:
innodb_additional_mem_pool_size = 2M |
去搜搜:
lnmp performance_schema_max_table_instances
lnmp下mysql 5.6内存占用过高解决方法 | simon博客:静水流深;美语善缘 – 南京SEO/SEM
之前安装LNMP:
时选择的是:
MySQL: 5.5.56
PHP: 5.6.31
但是我此处是2核4G内存,4G算不是大点的内容呢?要不要优化呢?
阿里云VPS下LNMP cpu 100% mysqld和php-fpm占内存的解决方法_discuz
好像另外的php-fpm也是有待于优化的。
低配VPS搭建typecho环境遇到的问题 – Illusionary
先去加上参数:
performance_schema_max_table_instances = 500
explicit_defaults_for_timestamp = true
再说:
[root@crifan ~]# cat /etc/my.cnf [client] #password = your_password port = 3306 socket = /tmp/mysql.sock [mysqld] port = 3306 socket = /tmp/mysql.sock datadir = /usr/local/mysql/var skip-external-locking key_buffer_size = 64M max_allowed_packet = 1M table_open_cache = 256 sort_buffer_size = 1M net_buffer_length = 8K read_buffer_size = 1M read_rnd_buffer_size = 512K myisam_sort_buffer_size = 16M thread_cache_size = 32 query_cache_size = 32M tmp_table_size = 64M performance_schema_max_table_instances = 500 explicit_defaults_for_timestamp = true #skip-networking max_connections = 500 max_connect_errors = 100 open_files_limit = 65535 log-bin=mysql-bin binlog_format=mixed server-id = 1 expire_logs_days = 10 default_storage_engine = InnoDB innodb_file_per_table = 1 innodb_data_home_dir = /usr/local/mysql/var innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /usr/local/mysql/var innodb_buffer_pool_size = 256M innodb_additional_mem_pool_size = 2M innodb_log_file_size = 64M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 64M sort_buffer_size = 1M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout |
然后重启mysql:
算了,为了避免影响,lnmp重启吧:
结果报错:
【已解决】lnmp中修改了mysql的配置文件/etc/my.cnf后重启失败:ERROR The server quit without updating PID file
结果发现内存占用还是:30多M,还是没有降低。。。
暂时不去深究和继续优化了。
【后记】
后来在:
【已解决】给Linode中的LNMP的crifan.com优化内存占用
中通过安装opcache后而解决了问题。