The droplet was created with WordPress on Ubuntu 14.04 image.
I’ve had a WordPress site (with probably zero traffic) running for a while now. Suddenly I noticed it reported a database connection error, fair enough. So I checked:
“service mysql status”
That returned stop/waiting, fair enough. Easy to get back running. It then crashed again eventually, and so forth.
I read up and noticed comments on creating a swap, which I then did exactly according to this guide.
“free -m” shows:
total used free shared buffers cached
Mem: 490 485 4 12 0 20
-/+ buffers/cache: 464 25
Swap: 4095 897 3198
The result of adding swap? My droplet is sometimes super slow while accessing it via SSH, i.e. typing into it lags. Never had this before, so I assume it is related. Also, the website doesn’t respond any longer. Ever. Sometimes the browser gets past connecting, but never past waiting.
What went wrong? Which logs should I check?
Surely a WordPress without almost no traffic shouldn’t have issues on even the smallest droplet. I’ve previously had a few sites running on the 512MB perfectly fine.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Yeah, might make it 512M.
Do you mean swappiness, or what by priority? The “sudo swapon -s” returns “-1”. Swappiness I did according to the guide I found about Ubuntu swap here on DO.
This comment has been deleted
This comment has been deleted
The second post describes your problem and the restart effects.
“It’s especially troublesome since the memory is allocated lazily and the memory usage builds up slowly. In some point caches are no longer caches, but swapped to a disk – virtual memory usage grows beyond available RAM.”
Other sites with mysql? What is the memory footprint of mysql proccess? Swapping is very bad for mysql performance. http://www.percona.com/blog/2010/01/18/why-swapping-is-bad-for-mysql-performance/ Have you tried mysqld optimizations ? http://opensourcehacker.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/
Other sites with mysql? What is the memory footprint of mysql proccess? Swapping is very bad for mysql performance. http://www.percona.com/blog/2010/01/18/why-swapping-is-bad-for-mysql-performance/ Have you tried mysqld optimizations ? http://opensourcehacker.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/
I am not a Linux expert, but what I read about, large swap is not good at max swap should be 2 times the RAM or at MAX not more than 2GB on VPS…
Everyone seems to say swap of 512MB with 512MB VPS… If your system needs more than 512MB swap, its better to increase RAM…
swap is really slow compare to RAM and swap is used as like Page file of Windows where HDD space is used as alternative to RAM in case of system running really low in memory to prevent crash…
Why would you want 4GB Swap with a 512MB RAM ??
I think you should not keep more than 512MB of swap…
Also in case of wordpress, make sure you are running some cache plug in to reduce the load on system…
Hope everything runs fine now !!
Yeah that’s the ones I did already. :)
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
Read more about that in Tweak your Swap Settings section…
Yeah, might make it 512M.
Do you mean swappiness, or what by priority? The “sudo swapon -s” returns “-1”. Swappiness I did according to the guide I found about Ubuntu swap here on DO.
I would still point 512MB Swap is more than enough… More swap may cause issues… Don’t ask me why, I am not the expert, I read and I saw people posting about problem with larger swap… If you really need more than 512MB swap, in that case you should upgrade to higher plans…
Use swap just as back up in emergency cases, but if you see, your system is regularly using swap, in that case its time to move to 1Gb RAM…
Secondly make sure swap priority is 60, not more than that…