Right now my application is hosted on a server with 12GB of RAM. I want to change my host and the new hosting service doesn't offer servers with 12GB of RAM.

I can pick from 8GB then the next plan offers 32GB of RAM which would be overkill and it costs too much.

Is there any way to know if 8GB would be enough RAM by checking how much memory my application is using on the current server?

  • If your application only occasionally needs more than 8 GB RAM installed, an alternative could also be to accept that it will have a severe performance impact when it happens, and set up a few gigabytes of swap space. But the first thing I would do is to simply ask the new provider if they are willing to provision 12 GB RAM for you. Assuming that you are looking at virtualized hosting (otherwise pretty much just put whatever fits in the server...), it's not any more difficult to provision a system with 12 GB RAM vs 8 GB RAM. They just might be willing to do it for a reasonable extra fee. – a CVn Feb 26 '17 at 17:36

You could use vmstat to have a look at some memory statistics of your machine in general. Check your process with ps vax and have a look at the columns RSS (resident set size, the non-swapped physical memory that a task has used) and %MEM to get an idea of the memory your process requires.

See the ps manpage for more details about the columns.


On your current server, under normal load you can check your overall RAM usage at any time with free -m. That might give you an overall view of how much memory your system is using when the app is working normally. Just keep in mind that the output might not be exactly what you think it is.

You can also use another tool, pmap It's usage is pmap PID. If the app is running multiple processes you might need to check all of the PIDs and summarize the final value.

To get all of the PIDs your app is using you can use pidof APPNAME

More on pmap here: https://www.cyberciti.biz/tips/howto-find-memory-used-by-program.html

About the free command: http://www.linuxatemyram.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.