Memory usage on new Arch linux droplet

January 21, 20145.4k views

Hi, all--
I recently opened an account here and have created my first (512MB) droplet, running Arch Linux.
I've been using Arch for about 7 years on my desktop & laptops, but have never had occasion to look in depth at which processes use how much memory (except in the case of misbehaving apps); this is my first time using Arch on a VPS.
Anyway, I'm exploring the system and getting some services set up, and I took a look at the memory usage; I was surprised to find that 'free -m' shows 422 of 494 M in use, and that is with virtually no services running. I also checked 'top'; the total memory usage figure is consistent with 'free', and there is no single process consuming large amounts of memory (the biggest is systemd at 0.618; most processes are shown at 0.000).
Then if I start nginx, mariadb, postfix, and php-fpm, all of which I am going to need, available RAM shrinks to about 8MB. It is looking like I will not be able to do any real work with this server configuration. I have created a swap file, but for the usual reasons I'd prefer to keep swap usage at a minimum.
So, what I'd like to know is:
* Can I trust the numbers I'm getting from 'free' and 'top'? Seems like I've heard those commands aren't always accurate on a VPS.
* Is there a better way to check my memory usage?
* I can certainly look over all my running processes and turn off any that I don't need ... but the 'top' output suggests that isn't going to do much. Are there any simple ways people have found to reduce memory usage?
Thanks for any tips!

Leave a Comment

What you might be looking at is the total memory use, which includes buffers and cache; memory that is being utilised by the operating system, but is available for programs to use as needed. Memory that is empty is technically being wasted, so the system uses as much as it can to increase performance. This is very normal on Linux.

As far as alternatives to top go, htop is an excellent piece of software and gives a much better visualisation of the system state, including memory usage split into used, buffers, and cache. The `free` program is perfectly reliable, though note that the second line of output (-/+ buffers/cache) contains the information you want.