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!
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!
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.
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.
Click below to sign up and get $100 of credit to try our products over 60 days!