简体   繁体   English

Wordpress中的高流量导致“建立数据库连接时出错”

[英]High traffic in Wordpress causing “Error Establishing A Database Connection”

I have a site hosted on an EC2 instance which I am able to crash by simply clicking the home button very fast very quickly (essentially a small scale DoS attack). 我有一个托管在EC2实例上的站点,我只需非常快速地单击主页按钮就可以崩溃(基本上是一个小规模的DoS攻击)。 The system log gives the following error: 系统日志提供以下错误:

Out of memory: Kill process 7744 (httpd) score 20 or sacrifice child

I've gone through all the usual steps and the problem persists. 我已经完成了所有常规步骤,问题仍然存在。 The steps I've taken so far include: 我到目前为止采取的步骤包括:

  • Upgrading PHP from 5.3.29 to 5.4.45 将PHP从5.3.29升级到5.4.45
  • Setting up browser caching and server side caching 设置浏览器缓存和服务器端缓存
  • Setting up GZIP 设置GZIP
  • Increasing the hosting instance to 2gb of RAM 将托管实例增加到2GB的RAM
  • Reducing plugins and compressing all images on the site. 减少插件并压缩网站上的所有图像。 Also compressing CSS and JS. 还压缩CSS和JS。

The PHP memory is set to 128mb and of that each session uses approximately 38mb which isn't overly high. PHP内存设置为128mb,每个会话使用大约38mb,这不是太高。

I don't think it's anything to do with wp-config.php or a corrupt database. 我认为这与wp-config.php或损坏的数据库无关。 The file (wp-config) seems fine and the site is only effected when handling lots of simultaneous requests. 文件(wp-config)似乎很好,只有在处理大量同时请求时才会影响网站。

The answer was to add more RAM, however lowing PHP memory usage by updating the software running on the server may also have helped. 答案是添加更多RAM,但是通过更新服务器上运行的软件来降低PHP内存使用量也可能有所帮助。 No issues since I've taken these actions. 自从我采取了这些行动以来没有任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM