Question

Memory usage on new Arch linux droplet

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!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

In amendment to my previous answer, an excellent explanation of memory usage in Linux can be found here: <br> <br>http://www.linuxatemyram.com/

Thanks, Stephen!

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. <br> <br>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. <br> <br>More information on Linux memory usage here: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Tuning_and_Optimizing_Red_Hat_Enterprise_Linux_for_Oracle_9i_and_10g_Databases/chap-Oracle_9i_and_10g_Tuning_Guide-Memory_Usage_and_Page_Cache.html