pjkcards
05-01-2014, 03:26 AM
I've been getting a few of these recently, but didn't happen much before. Travel has remained mostly constant for the last year so not sure why it is happening now:
Database error in vBulletin :
mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)
/home/x/public_html/sss/forum/includes/class_core.php on line 317
I contacted my host about this and they replied with this:
[--] Total buffers: 770.0M global + 9.3M per thread (500 max threads)
===
This means mysql by itself, without apache, without exim, just mysql, has 770 MB of memory just to run. Then, each connection adds another 9.3 MB. Your server only has 2560 MB of RAM:
===
root@host [~]# free -m
total used free shared buffers cached
Mem: 2560 599 1960 0 0 0
-/+ buffers/cache: 599 1960
Swap: 0 0 0
===
When the server runs completely out of memory, the kernel throws an OOM (Out Of Memory) error, wherein it starts killing processes to prevent the server itself from crashing. It usually starts with the processes taking up the most memory. If the mysql process is taking the most memory, it is likely to be the one chosen to be killed. However, if mysql is killed in this way, it can cause crashed tables. If a table is crashed, all subsequent queries to that table will fail, which usually has a much greater impact on the site than a few queries failing momentarily due to having reached the max_connections amount.
For this reason, it is not recommended to allow mysql to use more than 80% of the server's memory, to help prevent this issue from occuring. At 137 allowed connections, that would be 770M +9.3M * 137, or about 2044 MB, which is just slightly under 80% of the total ram of 2560 MB. This is how I arrived at this number for a max_connections to try for now.
If you do need more connections than this simultaneously, then it is very strongly recommended to reduce other mysql variables to either reduce the memory overhead (the ammount mysql takes even with zero connections), or the ammount of memory taken for each connection. If you do not know what these values need to be set to, it is strongly recommended to find a developer to help you. Once you know what the settings need to be set to, I can help you set them, if you let me know what settings need to be changed and what they need to be set to.
Another option of course is to add more memory to the server, however, if the site is inefficiently coded, it may still take up the server's resources even if there are more.
In the last hour, there have been 204 joins performed without indexes, and many temporary tables created to the disk:
===
[--] Up for: 1h 5m 11s (301K q [77.047 qps], 15K conn, TX: 7B, RX: 69M)
[!!] Joins performed without indexes: 204
[!!] Temporary tables created on disk: 46% (5K on disk / 12K total)
===
I strongly recommend finding a developer to help you fix these queries.
Any ideas how to fix this? Do I need to add more memory or there another solution? I'm running vB 4.2.1 and have been pretty much since it came out. And here are the versions of Apache, PHP, and mySQL:
Apache version 2.2.21
PHP version 5.2.17
MySQL version 5.1.73-cll
Thanks.
Database error in vBulletin :
mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)
/home/x/public_html/sss/forum/includes/class_core.php on line 317
I contacted my host about this and they replied with this:
[--] Total buffers: 770.0M global + 9.3M per thread (500 max threads)
===
This means mysql by itself, without apache, without exim, just mysql, has 770 MB of memory just to run. Then, each connection adds another 9.3 MB. Your server only has 2560 MB of RAM:
===
root@host [~]# free -m
total used free shared buffers cached
Mem: 2560 599 1960 0 0 0
-/+ buffers/cache: 599 1960
Swap: 0 0 0
===
When the server runs completely out of memory, the kernel throws an OOM (Out Of Memory) error, wherein it starts killing processes to prevent the server itself from crashing. It usually starts with the processes taking up the most memory. If the mysql process is taking the most memory, it is likely to be the one chosen to be killed. However, if mysql is killed in this way, it can cause crashed tables. If a table is crashed, all subsequent queries to that table will fail, which usually has a much greater impact on the site than a few queries failing momentarily due to having reached the max_connections amount.
For this reason, it is not recommended to allow mysql to use more than 80% of the server's memory, to help prevent this issue from occuring. At 137 allowed connections, that would be 770M +9.3M * 137, or about 2044 MB, which is just slightly under 80% of the total ram of 2560 MB. This is how I arrived at this number for a max_connections to try for now.
If you do need more connections than this simultaneously, then it is very strongly recommended to reduce other mysql variables to either reduce the memory overhead (the ammount mysql takes even with zero connections), or the ammount of memory taken for each connection. If you do not know what these values need to be set to, it is strongly recommended to find a developer to help you. Once you know what the settings need to be set to, I can help you set them, if you let me know what settings need to be changed and what they need to be set to.
Another option of course is to add more memory to the server, however, if the site is inefficiently coded, it may still take up the server's resources even if there are more.
In the last hour, there have been 204 joins performed without indexes, and many temporary tables created to the disk:
===
[--] Up for: 1h 5m 11s (301K q [77.047 qps], 15K conn, TX: 7B, RX: 69M)
[!!] Joins performed without indexes: 204
[!!] Temporary tables created on disk: 46% (5K on disk / 12K total)
===
I strongly recommend finding a developer to help you fix these queries.
Any ideas how to fix this? Do I need to add more memory or there another solution? I'm running vB 4.2.1 and have been pretty much since it came out. And here are the versions of Apache, PHP, and mySQL:
Apache version 2.2.21
PHP version 5.2.17
MySQL version 5.1.73-cll
Thanks.