我有一个用Wordpress制作的中型网站,每日点击量约为2000次,发布的帖子数量为3.000。该网站在EC2实例m3.xlarge上运行一年多没有任何问题。但我经常遇到RDS MySQL问题。
我的RDS实例如下:
Engine: MySQL 5.7.11
Instance: db.m3.medium
Type: Standard - Current
Generation vCPU: 1
vCPU Memory: 3.75 GiB
EBS Optimized: no
Network Performance: Moderate
Storage Type: General Purpose (SSD)
IOPS: disabled
Storage: 100 GB SSD
Parameter groups: default
Option groups: With Memcached
Memcached configuration (default, I have no idea how to use these settings):
INNODB_API_BK_COMMIT_INTERVAL: 5
ERROR_ON_MEMORY_EXHAUSTED: 0
MAX_SIMULTANEOUS_CONNECTIONS: 1024
CHUNK_SIZE_GROWTH_FACTOR: 1.25
VERBOSITY: v
INNODB_API_DISABLE_ROWLOCK: 0
BINDING_PROTOCOL: auto
CHUNK_SIZE: 48
INNODB_API_TRX_LEVEL: 0
CAS_DISABLED: 0
DAEMON_MEMCACHED_W_BATCH_SIZE: 1
DAEMON_MEMCACHED_R_BATCH_SIZE: 1
INNODB_API_ENABLE_MDL: 0
BACKLOG_QUEUE_LIMIT: 1024
问题是:
1)当连接的线程达到20-40个用户时,CPU RDS实例在几分钟内100%导致非常慢的导航;
2)同时连接的数量限制为296,但有时每天1或2次从平均5个连接跳到39个连接几分钟,并丢弃网站。
通过Mysql Workbench我发现以下SELECT运行时出现浏览速度慢和网站关闭的问题:
SELECT meta_key FROM wp_postmeta
WHERE meta_key !='_wp_page_template' AND meta_key !='_edit_last'
AND meta_key !='_edit_lock' AND meta_key !='_encloseme'
AND meta_key !='_pingme' GROUP BY meta_key