当前,我利用wordpress在阿里云平台构建了一个网站,但因为网站访问量日渐加大,阿里云服务器的负载会超出符合,尤其是mysql会自动中断执行。报告如下类似错误:
intermittent MySQL crashes with error "Fatal error: cannot allocate memory for the buffer pool"
140416 11:37:24 mysqld_safe Number of processes running now: 0 140416 11:37:24 mysqld_safe mysqld restarted 140416 11:37:24 [Note] Plugin ‘FEDERATED‘ is disabled. 140416 11:37:24 InnoDB: The InnoDB memory heap is disabled 140416 11:37:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins 140416 11:37:24 InnoDB: Compressed tables use zlib 1.2.3 140416 11:37:24 InnoDB: Using Linux native AIO 140416 11:37:24 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 140416 11:37:24 InnoDB: Completed initialization of buffer pool 140416 11:37:24 InnoDB: Fatal error: cannot allocate memory for the buffer pool 140416 11:37:24 [ERROR] Plugin ‘InnoDB‘ init function returned error. 140416 11:37:24 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed. 140416 11:37:24 [ERROR] Unknown/unsupported storage engine: InnoDB 140416 11:37:24 [ERROR] Aborting
解决方式:
调整mysql的设置,通常修改my.cnf或mysql.ini文件,将其中的innodb缓存空间设置调小,如下所示:
## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
当修改完成后,网站还是有可能会不定期挂掉。那么如何有效地自动化测试和验证网站的有效性,我这里推荐使用SOAtest构建自动化测试场景来验证网站的有效,在SOAtest中可以快速构建网站的自动化录制场景,并且可以快速设定回归测试Tool — Diff来通过判断消响应息头是否包含正确的内容来判定网站服务是否正常开启,还是出现了问题。
所以,我构建了一个SOAtest自动化测试场景,并且在该工具的配置项中设定了自动发送邮件报告到我个人工作邮箱;同时,设定操作系统每晚11点自动执行该测试场景。
时间: 2024-10-05 11:01:52