LAMP droplet high memory usage with no traffic on Ubuntu 16.04

My Droplet (512 MB Memory, LAMP, Ubuntu 16.04) uses 70%+ of it’s memory since I created it, even when I’m not running the application.

When I stop running my app, I can see the memory usage drop by 10 to 15%, but it’s still consistently high. I have a firewall setup so only my and a colleagues IP have access to the app.

In the Graphs section of the Droplet I can see the following processes consuming the most energy (high to low): apache2: 48% mysqld: 29% fail2banserver: 2.8%

All the other processes after that don’t contribute significantly (less than 2%).

I’ve read this post, and if I run free -m I get:

 total        used        free      shared  buff/cache   available
Mem:            488         347          22          16         118          94
Swap:             0           0           0

So it looks like the RAM really isn’t available. How can I figure out what’s going on?

Show comments

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.

If you are concerned about memory usage you can use top to see which specific processes are using exactly how much RAM. The output you provided here from free only lists the totals which isn’t very useful for troubleshooting.

There’s a tutorial on reading output from top here:

After you review your usage you can decide that if something is using a lot of RAM and not needed to disable it.

But if you are running a lamp configuration you will have Apache, php, MySQL running, and then you can see which one of them is taking up the most resources.

Also note that if the server isn’t under any load and using 30% memory, it doesn’t mean that your RAM usage will immediately spike if you start to receive traffic, as a lot of the processes are just sitting there idling and waiting to process a request.