Memory is one of the most important resource components on a server to ensure that process run smooth and fast. Thus, the availability of physical memory for any server is very important, especially for high load web host server which runs database server such as Oracle or MySQL, which require high memory utilization for smooth running. Linux [CentOS] which is popular on cPanel and Plesk web hosting server, comes with several commands and tools to check memory usage on server
1. meminfo
"/proc/meminfo" contain all your memory usage information when you type:
cat /proc/meminfo
you will get an out of your server memory info, below is an example of meminfo.
2. Using free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
free -m
The command will display information about physical memory in MB.
free -m -t
Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.
free -m -s 10
The command will display memory status in megabytes on terminal with continuous polling delay at 10 seconds,You can specify any number for delay.
3. Using vmstat Command
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The command will display report based on averages since last reboot.
Syntax of vmstat
vmstat -[options] [delay count]
vmstat 10
The command will pool average system resources usage level for a sampling period of 10 seconds at interval of 10 seconds, except the first result that is averages since the last reboot.
If no delay is specified, only one report is printed with the average values since boot.
4. Using top Command
Syntax of top
top
Using top is very simple, Just type "top" at command shell [without ""], it constantly update stats page will be shown.
top -d 2
Same as "top", but "-d" used to Specifies the delay between screen updates after 2 sec.
5. Using ps Command
Syntax of ps aux
ps -aux
aux is the options for ps command to see every process on the system.
To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
Enjoy:)
How to Check Memory Usage on Linux Servers.
Posted by Mayur's BLOG
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment