A common issue when running low capacity Virtual Private Servers, is running out of memory. One of the first indications of low available memory is a sudden series of segmentation faults (aka: segfaults). Segfaulting is a common occurrence when running out of available RAM inside your VPS.
MySQL is a frequent culprit; it's possible to run MySQL on low memory, but doing so requires some basic tuning effort on your part:
In essence, the default MySQL installation on Debian/Ubuntu has a cold-start requirement of around 25MB RSS. This works well, unless you're running a tight ship with limited memory. Depending on how important MySQL is to your environment, reducing MySQL's memory demands will help lower RSS RAM requirements, and enable room for other services in your VPS.
The easiest solution is to install the stock package, immediately shutdown MySQL after installation, and then tune the existing configuration file for adequate performance. On Debian/Ubuntu, try replacing /etc/MySQL/my.cnf with my-small.cnf (located in /usr/share/doc/my-server-5.0/examples). Some important notes:
After a few adjustment you should be able to start MySQLd at around 5-6MB RSS. You should check the runtime variables, and monitor performance…everything will work out with just a bit of tuning.
As for keeping an eye on future usage, the /proc/user_beancounters file is quite useful. Here's a VPS which recently ran out of RAM:
~$: cat /proc/user_beancounters
uid resource held maxheld barrier limit failcnt
178: kmemsize 1279489 2741110 11055923 11377049 0
lockedpages 0 0 256 256 0
privvmpages 31992 32869 32768 32768 57
shmpages 8 344 21504 21504 0
dummy 0 0 0 0 0
numproc 20 27 240 240 0
physpages 5162 5915 0 2147483647 0
vmguarpages 0 0 16384 16384 0
oomguarpages 5162 5915 26112 2147483647 0
numtcpsock 3 4 360 360 0
numflock 4 5 188 206 0
numpty 1 1 16 16 0
numsiginfo 0 2 256 256 0
tcpsndbuf 26880 0 1720320 2703360 0
tcprcvbuf 49152 0 1720320 2703360 0
othersockbuf 4480 21760 1126080 2097152 0
dgramrcvbuf 0 8384 262144 262144 0
numothersock 5 10 360 360 0
dcachesize 136144 156464 3409920 3624960 0
numfile 439 572 9312 9312 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 10 10 128 128 0