2

My Joomla 3.6 website up time is pretty good, however at times of high traffic, my site shows a white page with the following text;

Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.

What would cause this?

I've read that it's normally a setting in the configuration.php file but surely if that was the case my site would never work?

Is there anything I can check or optimise regarding the database? Perhaps logs?

I should add that this is on a shared hosting server (JustHost).

Any advice is appreciated.

2
  • Do you manage your own server or use a hosted solution? The error means Joomla can't connect to the DB. Usually, this is the result of incorrect MySQL access credentials; but in your case it sounds like the DB stopped accepting connections for whatever reason during times of high load. Aug 24, 2016 at 16:54
  • @BrianBolli is right. If you haven't changed anything recently in your configuration.php or with the database user (name, password, permissions) or the database name, then it is a hosting issue. It tends to happen periodically on cheaper/shared hosting. Aug 24, 2016 at 18:42

6 Answers 6

2

Although there is limited information, based on the fact this only occurs during times of heavy site traffic, my thought is you've either exceeded your maximum concurrent connection for the Mysql database or the database crashes do to lack of server resources.

Either way, check your database logs. Update your post with them if you need further help.

2

With the limited info you provided there are only 2 things that are most likely the reason.

  1. your server does not have enough resources and may need an upgrade.
  2. you have a php injected script that is constantly running a script that uses up the resources.

I would look at your resources, via control panel server side and see if indeed there are constant php processes running.

1

A lot of traffic can make the Joomla sessions table cause a high Mysql disk I/O. This can result in myslq timing out. Check the resource monitor for Mysql disk I/O. It's possible this does not show up in the form of high CPU or RAM usage.

1

Shared hosting is very bad for any serious business. Before doing anything, you should invest a bit more money into your website and move to a VPS (that move will pay for itself since Google ranks faster websites higher).

Once you do that, you can then tweak your InnoDB settings (and perhaps modify the core) in order to enhance the performance of your Joomla website (if your website is fairly large, then this post may help). If everything is fine but you are still having issues, then you will need to monitor your slow query log for any slow queries and optimize these queries.

Again, you should - you really should move from shared hosting to at least a VPS. Shared hosts typically do not care much about the performance of the websites on a shared host server (in fact, some may block or may aggressively cache resource intensive websites).

1

Sounds like your problem is too many SQL connections, combined with CPU overload. Here's what I did for a site that gets 25,000 hits a day that I host:

  1. If you have a dedicated or VPS, increase number of SQL connections to 150. Most servers have them set to 100. Contact your host support and have them go through your Tweak Settings in WHM. If you need good hosting, I use InMotion Dedicated. Very happy with them.
  2. Avoid lots of Admins logged on at the same time. We found out that Joomla opens as many as 10 'sleeping' SQL connections per login, 4 Admins at the same time, you only have 10-20 left for visitors.
  3. Use a CDN. Let me say that again - use a CDN!
  4. Enable Conservative Caching. Progressive Caching is not recommended for high traffic Joomla sites.
  5. Upgrade the server to more CPU cores and more RAM, if possible.

  6. Install Admin Tools from Akeeba, it detects and blocks hackers and spammers, reducing overall traffic.

Some common sense items here too, like use small/optimized images, try to use GZIP in your template if supported, disable all Javascripts you don't need. Also, use a program like https://gtmetrix.com/ to analyze the site and let you know if there are any issues that would increased load time.

0

Reducing the load on the server by enabling the cache or similar may help (if you haven't done this already).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.