Server crashing, Memory issues

So this all started with a complaint from our host, Linode that our server's CPU usage is high and its affecting other resources on their machine. Our site went too slow, it used to take at least a minute to load.
We tried to diagnose the issue but no improvement. So we created a new instance and set-up everything from scratch i.e. new Xenforo installation, and imported our DB.
Now we are facing strange behavior.
Sometimes the website loads normal but other times these errors alternatively appear:

"An unexpected database error occurred. Please try again later. "
(when we check the page source of this error it says "no such file or directory" and sometimes it says "resources currently unavailable" )

An exception occurred: Mysqli prepare error: MySQL server has gone away in /var/www/html/urdumajlis.net/public_html/library/Zend/Db/Statement/Mysqli.php on line 77

Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 808
Zend_Db_Adapter_Abstract->fetchPairs() in XenForo/Template/Public.php at line 130
XenForo_Template_Public->_getTemplatesFromDataSource() in XenForo/Template/Abstract.php at line 586
XenForo_Template_Abstract->_loadTemplates() in XenForo/Template/Abstract.php at line 570
XenForo_Template_Abstract->_loadTemplate() in XenForo/Template/Abstract.php at line 189
XenForo_Template_Abstract->render() in XenForo/Template/Public.php at line 110
XenForo_Template_Public->render() in XenForo/ViewRenderer/HtmlPublic.php at line 140
XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 662
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 176
XenForo_FrontController->run() in /var/www/html/urdumajlis.net/public_html/index.php at line 13
Apache error log has the following error:

mmap() failed: [12] Cannot allocate memory

Our current Linode plan has RAM of 8GB.
Can you please help us finding the underlying issue?
 

gerryvz

Well-known member
Linode is a VPS provider, so they shouldn't be throttling anything except the parameters beyond the purchased VPS capacity.

What operating system and software are you running on your Linode?

I use a 4GB Linode to run my forum and it works very well, with only around 10% of the CPU utilized (this varies between 2 and 20% depending on what is going on). In addition to the forum software, I am running Java 11 and Elasticsearch, MySQL 5.7, Apache 2.4, and other software with zero issue.

It looks to me like you may have some misconfigurations or incompabilities in your setup, as an 8GB Linode has PLENTY of excess memory and compute capacity to handle pretty much anything you can throw at it.

Have you gone into the Longview app in your Linode control panel, and taken a look at the process list to see what processes are running, and the level of resources they are consuming? It appears if your processor usage is that high, that you may have some sort of runaway process due to a faulty or misconfigured installation.

More information and perhaps a screen shot of your process list would be helpful.....
 
Linode is a VPS provider, so they shouldn't be throttling anything except the parameters beyond the purchased VPS capacity.

What operating system and software are you running on your Linode?

I use a 4GB Linode to run my forum and it works very well, with only around 10% of the CPU utilized (this varies between 2 and 20% depending on what is going on). In addition to the forum software, I am running Java 11 and Elasticsearch, MySQL 5.7, Apache 2.4, and other software with zero issue.

It looks to me like you may have some misconfigurations or incompabilities in your setup, as an 8GB Linode has PLENTY of excess memory and compute capacity to handle pretty much anything you can throw at it.

Have you gone into the Longview app in your Linode control panel, and taken a look at the process list to see what processes are running, and the level of resources they are consuming? It appears if your processor usage is that high, that you may have some sort of runaway process due to a faulty or misconfigured installation.

More information and perhaps a screen shot of your process list would be helpful.....
Thank you for your interest.
We are using Ubuntu 18.04 and LAMP stack.
CPU usage is now in control since we upgraded our Linode instance. We increased memory to 8GB just for the time being to see how it goes.
I agree that 4 GB was also enough just to run Xenforo.

Right now we are facing mysql server crash. Its not running any more. We are unable to start. Below I'm posting mysql error log and the response of >systemctl status mysql.service
error.PNGmysql_status.PNG
 

gerryvz

Well-known member
Hopefully you have a backup of your XF database that is not corrupted.

I recommend that you remove and then re-install MySQL, and reconfigure XF and Apache for it.
 
Hopefully you have a backup of your XF database that is not corrupted.

I recommend that you remove and then re-install MySQL, and reconfigure XF and Apache for it.

So I have now re-installed everything.

The site again seems a bit slow although there are no errors in mysql log so far.
There is one suspicious thing. Since we are facing server crashes number of robots have increased. Is this a probable cause of crash? right now we have 174 robots which is quite abnormal. How to resolve this issue?
 
Top