Answer the question
In order to leave comments, you need to log in
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
[email protected]:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise
[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
[email protected]:~# mysql --version
mysql Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6. 2
Answer the question
In order to leave comments, you need to log in
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.
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.
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 questionAsk a Question
731 491 924 answers to any question