最新消息:20210917 已从crifan.com换到crifan.org

【记录】尝试Linode中的crifan.org的LNMP中去优化MySQL去优化内存占用

MySQL crifan 2508浏览 0评论

折腾:

【已解决】给Linode中的LNMP的crifan.org优化内存占用

期间,

去看看,能否通过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启动时占用内存优化 – Web服务器 – VPS侦探论坛 – 美国VPS|VPS测试、点评|VPS主机推荐|VPS主机架设优化|美国服务器|LNMP一键安装包|Linux|VPS优惠信息

之前安装LNMP:

【记录】重新给Linode中CentOS安装LNMP

时选择的是:

MySQL: 5.5.56

PHP: 5.6.31

但是我此处是2核4G内存,4G算不是大点的内容呢?要不要优化呢?

阿里云VPS下LNMP cpu 100% mysqld和php-fpm占内存的解决方法_discuz

好像另外的php-fpm也是有待于优化的。

CentOS6.3搭建LNMP环境

MySQL5.6 内存占用过高问题 | 石建文

低配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.org优化内存占用

中通过安装opcache后而解决了问题。

转载请注明:在路上 » 【记录】尝试Linode中的crifan.org的LNMP中去优化MySQL去优化内存占用

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.184 seconds, using 23.39MB memory