Error establishing a database connection after Apache JMeter Test

Hey Guys,

First of all I’ve looked for this issue in the community and over the web as well but I don’t understand the answers or didn’t find the answer at all.

My System

  • AWS EC2 (T2.Small) - 1 vCPU - 2GB RAM
  • CentOS 7.9 and using Webmin Panel
  • The Websites Using WordPress

In this BlackFriday I expect hundreds of visits so I tried to use Apache JMeter to test my website (100 Users in 10 Seconds) without Cloudflare so the CPU usage became 103% and and a lot of memory usage, the MySQL is down and restarted (because I’m using RestartAlways command in the configuration), Anyway I decide to use the Cloudflare to protect my website from DDoS attack so I moved from Route53 to Cloudflare and configuring it like the Docs then I try to test my website with JMeter once again then I noticed that the CPU Usage and the RAM is very normal but MySQL Server is out of memory without stop working (My other domains in the same EC2 don’t use Cloudflare are working properly) But the Cloudflare’s website generates (Error establishing a database connection) … Calm Down and don’t say go to search :smile: I already have looked for that issue because I don’t want to wait for community but I nothing help … Anyway the website start working again in few seconds without any action from me but this scenario is not good with visitors so I need to solve that.

The MySQL’s log file Out Of Memory messages:

InnoDB: mmap(137756672 bytes) failed; errno 12
201118 13:16:35 InnoDB: Completed initialization of buffer pool
201118 13:16:35 InnoDB: Fatal error: cannot allocate memory for the buffer pool
201118 13:16:35 [ERROR] Plugin 'InnoDB' init function returned error.
201118 13:16:35 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
201118 13:16:35 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
201118 13:16:35 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
201118 13:16:35 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
201118 13:16:35 [Note] Plugin 'FEEDBACK' is disabled.
201118 13:16:35 [ERROR] Unknown/unsupported storage engine: InnoDB
201118 13:16:35 [ERROR] Aborting

Anyone can help?


This is my Cloudflare’s DNS Records

Cloudflare’s SSL/TLS:

  • Full (strict) because I’m using Lets Encrypt free certificate for all domains.
  • Always Use HTTPS is ON

I’m hoping it’s as easy as configuring your app to make the DB connection to the IP address instead of the hostname. Normally, I use ‘localhost’ and that fixes it. Or try…or the actual IP address you blurred out in your “A” records.

Really? Can I hard-coded the IP instead of localhost in DB_LocalHost? I mean could that solve this issue?

It says ‘localhost’ already? Then that’s probably not the problem, but you’re welcome to give it a try.

Otherwise, it’s a run of the mill Out Of Memory error you’ll need to troubleshoot. My lazy approach would be to reboot. It could just be that MySQL never recovered from the load test and needs to be restarted.

Once that’s back on track, hopefully it won’t happen again under load.

Any help guys? Does anyone fix that issue? I see a lot of topics like it

Now that I’m taking a closer look, this certainly doesn’t look Cloudflare-related. Your server just doesn’t have the capacity for a heavy load.

1 Like

So you’re saying that if I’m upgrading to another instance (Say 4GB RAM) will not down?

Since the error message is related to memory issues, you can give it a shot.
It’s pretty easy to change the instance type in AWS.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.