@mosaic - The free -m
command will output something such as:
total used free shared buffers cached
Mem: 2000 1982 18 0 95 1666
-/+ buffers/cache: 220 1780
Swap: 0 0 0
What this means is that I have 2000MB
of RAM, I’ve “used” 1982MB
, of which 1666MB
is cached and 95MB
is buffer.
You can also use
free -mh
for an easier to read and pre-converted output which is converted to MB & GB instead of the default shown above, such as:
total used free shared buffers cached
Mem: 2.0G 1.9G 20M 632K 88M 1.6G
-/+ buffers/cache: 210M 1.7G
Swap: 0B 0B 0B
What this does is simply tell you how much RAM you’re currently utilizing as of command execution.
–
That said, the free -m
or free -mh
command isn’t going to tell you where your problem is. You really need to look at RAM usage by process, specifically MySQL, Apache/NGINX, PHP etc.
To start, I’d advise downloading, installing and running MySQL Tuner (installation and usage details are on the main page of the site). This needs to be done as the root
user from the command line interface (CLI). Once executed, it’ll provide you with a plethora of information that can be used to diagnose RAM usage by MySQL as well as overall performance.
If you would, run MySQL Tuner, copy & paste the results in a PasteBin and post the link to the PasteBin here. I’ll be more than happy to look over it for you.
It’ll also be helpful to see what the top output is. You can do this by running:
top
And then pressing shift m
followed by c
on your keyboard. That’ll sort the processes by RAM usage and expand the commands / processes. You can then select (copy) and paste that in to the PasteBin as well.
–
To expand on the “used” RAM above, simply because I’ve “used” 1.9GB out of the 2GB I’ve been allocated does not mean that I’ve used that much. The 1.6GB’s from the cache column is included in that 1.9GB’s, so my actual usage is only ~300MB. The other 1.3GB is cached and used by current processes until they are either stopped, killed or restarted.
This particular Droplet does not have a swap allocation, which is why swap
reports all 0’s.
What output do you see when running
free -m
?