简体   繁体   中英

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). 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
  • Setting up browser caching and server side caching
  • Setting up GZIP
  • Increasing the hosting instance to 2gb of RAM
  • Reducing plugins and compressing all images on the site. Also compressing CSS and JS.

The PHP memory is set to 128mb and of that each session uses approximately 38mb which isn't overly high.

I don't think it's anything to do with wp-config.php or a corrupt database. The file (wp-config) seems fine and the site is only effected when handling lots of simultaneous requests.

The answer was to add more RAM, however lowing PHP memory usage by updating the software running on the server may also have helped. No issues since I've taken these actions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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