R
R
Roman Kokarev2014-02-15 02:50:01
linux
Roman Kokarev, 2014-02-15 02:50:01

Why does VPS crash on DigitalOcean?

Hello!
VPS is spinning (the one that is the most inexpensive - at 512 mb) on DigitalOcean . 2-3 sites on WordPress are served. Rarely visited and not with a particularly huge number of plugins.

The problem is that periodically the server suddenly freezes. Sometimes you can connect via SSH and restart Apache (with a muscle), sometimes only a reboot helps, and sometimes you have to restart directly from the panel.

As a rule, when opening any site located on the server, it gives the famous error

Error establishing a database connection


I think the problem is the lack of memory? What to tune? Maybe switch to CentOS or another server distro?
Most likely, the memory is littered. But I would like to fix it somehow.

OS:
[email protected]:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:        12.04
Codename:       precise


Memory:
[email protected]:/var/www# free -m
             total       used       free     shared    buffers     cached
Mem:           490        456         34          0         12        134
-/+ buffers/cache:        310        180
Swap:         5394          0       5394


MySQL:
[email protected]:~# mysql --version
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.                                                                                                 2


Apache/2.4.7

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pomeo, 2014-02-15
@kokareff

reboot server on out-of-memory condition
/etc/sysctl.conf
vm.panic_on_oom=1
kernel.panic=10
The vm.panic_on_oom=1 line enables panic on OOM, the kernel.panic=10 line tells the kernel to reboot ten seconds after panicking.

V
Vasily, 2014-02-15
@VasiliyIsaichkin

Little memory? - Throw apache out in the cold, install nginx and php-fpm.
Ubuntu is ok. Mysql is better from Percona ( www.percona.com/doc/percona-server/5.5/installatio... ) (binary compatible with MySQL)
Never had any problems with DO itself.

E
Egor, 2014-02-15
@methodx

Apache2: edit config, limit MaxClients. Ideally, either place it behind Nginx or really use the nginx + php-fpm bundle. Apache2 is not a web server, but an application server in the first place, you should take this into account and use it wisely.
Mysql: use mysqltuner.pl to detect bottlenecks in the configuration, limit the maximum memory usage by changing the variables specified by the script. Consider using Percona or MariaDB.
Use htop to track resource consumption.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question