你好,服务器故障社区,
我有一个中等大小的VPS,我运行2个Magento安装,几个静态页面以及几个WordPress / Joomla安装--所有个人网站和项目--总体上没有什么特别的花哨或者流量非常大。
我的VPS规格:
内存: 12288 MB,CPU核心:4×2.4GHz,OS: CentOS,Extras: WHM / cPanel
一般来说,速度总是存在的,我不能抱怨,但是最近我注意到网站加载速度较慢,更具体地说,所有的网站都需要一个MySQL数据库。
我向某人征求意见,有人告诉我,这很可能与我的数据库的增长和/或一个糟糕的my.cnf配置文件有关。
我当前的my.cnf如下所示:
[mysqld]
open_files_limit=64000
local-infile=0
query_cache_size=512M
query_cache_limit=2M
default-storage-engine=MyISAM
innodb_file_per_table=1
thread_cache_size=4
join_buffer_size=4M
key_buffer_size=128M
table_cache=640
log-slow-queries=/home/mysql-slow-queries.log
long_query_time=1建议我运行mysqltuner,这样做的输出如下:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.32-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 165M (Tables: 1034)
[--] Data in InnoDB tables: 92M (Tables: 1101)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 372K (Tables: 55)
[!!] Total fragmented tables: 25
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 4h 39m 42s (571K q [34.034 qps], 15K conn, TX: 786M, RX: 113M)
[--] Reads / Writes: 54% / 46%
[--] Total buffers: 800.0M global + 6.6M per thread (151 max threads)
[OK] Maximum possible memory usage: 1.8G (14% of installed RAM)
[OK] Slow queries: 0% (2/571K)
[OK] Highest usage of available connections: 7% (12/151)
[OK] Key buffer size / total MyISAM indexes: 128.0M/40.3M
[OK] Key buffer hit rate: 96.5% (548K cached / 18K reads)
[OK] Query cache efficiency: 93.2% (440K cached / 472K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 7K sorts)
[!!] Joins performed without indexes: 946
[OK] Temporary tables created on disk: 11% (2K on disk / 22K total)
[OK] Thread cache hit rate: 99% (63 created / 15K connections)
[!!] Table cache hit rate: 0% (634 open / 268K opened)
[OK] Open file limit used: 1% (980/64K)
[OK] Table locks acquired immediately: 99% (121K immediate / 121K locks)
[OK] InnoDB data size / buffer pool: 93.0M/128.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
join_buffer_size (> 4.0M, or always use indexes with joins)
table_cache (> 640)在提供此输出后,建议应用以下更改:
thread_cache_size=16
query_cache_size=1024M
join_buffer_size=8M
table_cache=4096我的问题:
我肯定不是专家或系统管理员,而只是一个业余爱好者,因此,如果有人能分享一下我如何改进/增强我目前的配置的一些见解,那将是非常感谢的。非常感谢。
发布于 2013-08-19 12:31:29
可以安全地应用更改,重新加载服务器,然后运行mysqltuner,检查以下字符串:
好的最大可能内存使用量: 1.8G (已安装内存的14%)
https://serverfault.com/questions/531910
复制相似问题