ipgof
By:
ipgof

MySQL using 80% of my droplets RAM

June 24, 2016 547 views
MySQL PHP Ubuntu 16.04

I recently wrote a small web app in PHP that needs a database. So I chose MySQL with the idea that it would be efficient and not taking up any memory. My droplet has 1GB of RAM with 30GB of storage on Ubuntu 16.04. I started noticing the memory problem after I was getting warnings from APT trying to update my packages list (FATAL -> Failed to fork).

So then I ran ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -2 to check what processes were using all the memory. Here is the output:

80.0  0.0 2611632 1236 /usr/sbin/mysqld
1.6  0.0 274288  1427 /usr/sbin/apache2 -k start

I can tell from here that MySQL is using 80% of the RAM on my droplet. Is there any way to make is more memory efficient so I don't have to upgrade to more RAM on my droplet?

I am pretty new to being a sysadmin so I don't know much about dealing with databases and such.

Thank you.

3 comments
  • What's the output to the following command when the memory utilisation gets very high:

    mysqladmin status
    
  • Uptime: 1123  Threads: 1  Questions: 11  Slow queries: 0  Opens: 115  Flush tables: 1  Open tables: 34  Queries per second avg: 0.009
    
  • @cmelone - those stats looks normal. The two other things to look for are swap (created and in use) and xmlrpc attacks. See the solutions provided from this previous question

1 Answer

This question was answered by @gndo:

@cmelone - those stats looks normal. The two other things to look for are swap (created and in use) and xmlrpc attacks. See the solutions provided from this previous question

View the original comment

Have another answer? Share your knowledge.