As I develop on Scala/Play/Mongo I'm comfortable with maintaining my own server. About a month ago I've got a small VPS (2GB of RAM) from DigitalOcean and prepared it as my host environment by installing the following packages as usual:
- Nginx (as front-end server)
- Email Server
- RoundCube (as webmail)
- OpenJDK 7
As you may guess they would need a reasonable amount of RAM.
I also have a publish script on my local machine which compiles the source (using
stage), pushes it to the special repository on deployment server (using
git) and restarts the embedded server of the Play application (using
I've deployed several applications the same way successfully but this time I had a problem. There were three running Play applications on this server. The problem was that applications stop running once in a while with an
hs_err_pid*.log file which indicates that the memory is insufficient! Worse than that, Play web server wasn't getting started after publish.
Today, I accidentally found out that the server swap is zero. This was the main reason of insufficient memory error. After adding the swap file the server and web apps are working like a charm.
I don't need all of running processes to be lightning fast. Plus, the more the process is used the more priority it receives.
Always check the server swap before any other action on your VPS.