How to Check Memory Usage in Linux based Server如何检查记忆体使用量在基于Linux的服务器
Memory is one of the most critical resource components on a server to ensure that the smooth and fast operation.记忆体是其中一个最关键的资源组件在服务器上,以确保顺利和快速的运作。 Thus, the availability of adequate and abundant physical memory size is vital especially for any server, especially high load web host that are also running database server such as Oracle or MySQL, which is famous for memory intensive.因此,提供足够的和丰富的物理内存大小是非常重要的,尤其是对于任何服务器,特别是高负载网络的主机也运行数据库服务器如Oracle或MySQL的,这是著名的记忆体密集。 Linux, including CentOS which is popular on cPanel and Plesk web hosting server, comes with several commands and tools to check memory usage on server. Linux的,包括centos这是上流行的cPanel和plesk虚拟主机服务器,还带有一些命令和工具来检查记忆体使用量在服务器上。
free 自由的
free command displays amount of total, free and used physical memory (RAM) in the system, as well as shoing information on shared memory, buffers, cached memory and swap space used by the Linux kernel.免费命令显示的金额总数,自由和使用的物理内存( RAM )在该系统中,以及shoing的信息共享存储器,缓冲器,快取记忆体和swap空间所用的Linux内核。
Syntax of free 语法免费
free -[options]免费-[选项]
Example usage of free 例如使用免费
free -m免费-米
The command will display information about physical memory in MB.该命令将显示信息的物理内存以MB 。
free -m -s 5免费-米- S的5
The command will activate continuous polling delay at 5 seconds apart, and then display memory status in megabytes on terminal.该命令将启动连续投票站延迟在五秒除了,然后显示记忆体的地位,在兆字节的终端。 Any floating point number for delay can be specified.任何浮点运算的数目为延迟就可以指定。
free -t -m免费-吨-米
Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.同时,与“免费-米” ,但- t参数,将显示一条线载总数的物理内存和swap空间。
vmstat vmstat
vmstat reports report virtual memory statistics, which has information about processes, swap, free, buffer and cache memory, paging space, disk IO activity, traps, interrupts, context switches and CPU activity. vmstat报告,报告虚拟内存统计,其中有有关进程的信息,互换,免费,自由,缓冲和快取记忆体,分页空间,磁盘IO活动,陷阱,中断,上下文开关和CPU活动。 With vmstat command, administrators can has instantaneous reports on memory usage.与vmstat命令,管理员可以有瞬时的报告对记忆体使用量。
Syntax of vmstat 语法vmstat
vmstat -[options] [delay count] vmstat -[选项] [延迟计数]
Example usage of vmstat 例如使用vmstat
vmstat
The command will display report based on averages since last reboot.该命令将显示报告的基础上平均自去年重新启动。
vmstat 5 vmstat 5
The command will pool average system resources usage level for a sampling period of 5 seconds at interval of 5 seconds, except the first result that is averages since the last reboot.该命令将池平均系统资源的使用水平,为采样周期为5秒,间隔5秒钟,除了第一个结果是平均数,自上次重新启动。
top 顶端
top command displays dynamic real-time view of the running tasks managed by kernel and system information in Linux system.顶端命令显示动态实时时间,鉴于对运行任务管理内核和系统信息在Linux系统。 The memory usage stats by top command include real-time live total, used and free physical memory and swap memory with their buffers and cached memory size respectively.记忆体使用量的统计顶端命令,包括实时直播的总时间,用的和可用的物理内存和交换的记忆与他们的缓冲器和快取记忆体大小分别。
Syntax and example usage of top 语法和用法,例如顶端
top顶端
Using top is simple, simply type top at command shell, and constantly update stats page will be shown.用最简单,只需键入顶端,在命令外壳,并且不断更新的统计资料页将显示。
ps aux 保安局常任秘书长辅助
ps command reports a snapshot on information of the current active processes.常任指挥报告的快照的资料,对当前活跃的进程。 Advantage of ps command is that system admins will be able to see where the memory is used.利用PS的命令是系统管理员将能够看到那里的记忆是用来。 ps will show the percentage of memory resource that is used by each process or task running in the system.保安局常任秘书长将显示百分比的内存资源,是所用的每一个进程或任务运行在该系统。 With this command, top memory hogging processes can be identified.与此命令,顶端内存荒加工过程中可以查明。
Syntax and example of ps aux 语法和榜样的PS辅助
aux is actually already the options for ps command to see every process on the system.辅助,其实是已经选择的PS命令查看每一个过程在系统上。 So the typical command to type the following in the command shell:因此,典型的命令,键入以下,在命令外壳:
ps aux 保安局常任秘书长辅助
To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:看到只有内存资源占用每类进程,如Apache的httpd , MySQL的mysqld或Java ,使用下列命令:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr 保安局常任秘书长辅助| awk ' (打印4元, “ \吨” 11元) ' |排序| uniq - C的| awk ' (打印$ 2 “ ” $ 1 “ ” $ 3 ) ' |排序-二○ ○
The all mentioned ways of check memory usage should works on most Unix and Linux variant of operating systems.所有提到的方法检查记忆体使用量应工程,对大多数Unix和Linux变的操作系统。 However, if you’re running a VPS (Virtual Private Server) or VDS (Virtual Dedicated Server) or Hybrid Server, especially those powered by Virtuozzo or OpenVZ, the above commands will retrieve data from the host machine, ie the entire server the virtual environment is running on.然而,如果您正在运行的电子道路收费(虚拟专用服务器)或自愿离职计划(虚拟专用服务器)或混合式服务器,特别是那些由Virtuozzo软件或openvz ,上述命令将检索数据从主机上,即整个服务器的虚拟环境上运行。 In these virtualization system, the memory usage info has to be calculated from control panel or /proc/user_beancounters file.在这些虚拟化系统,记忆体使用量的信息要计算从控制面板或系统/ proc / user_beancounters档案。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- Ubuntu 6.06 Reviews Ubuntu的6.06评语
- Open, Extract and Convert DAA, ISO and BIN Files in Linux with Free PowerISO for Linux开放,提取和转换daa ,国际标准化组织和本文件在Linux与自由poweriso为Linux
- Novell SUSE Linux Enterprise Server 10 Reviews Novell公司的SUSE Linux Enterprise Server 10评语
- Cheapest Linux Box Ever最便宜的Linux的方块以往任何时候都
- Find Out Linux Orphan Processes找出Linux的孤儿进程
- Paessler Router Traffic Grapher PRTG 5.3 Review by Computing paessler路由器交通grapher prtg 5.3审查通过计算
- How to Check if Telnet Is Running on a Server如何检查,如果Telnet是运行在服务器上
- Start, Stop and Restart Crond Daemon in Linux开始,停止并重新启动crond守护进程在Linux
- Download Free VMWare Server Virtualization Software下载免费的VMware服务器虚拟化软件
- How to Mount USB Disk Drive in UNIX or Linux如何挂载的USB磁盘驱动器在UNIX或Linux



















September 24th, 2007 15:20 2007年9月24日15时20分
When you are running top there are three fields related to memory usage.当您正在运行的顶端有三个领域相关的记忆体使用量。 In order to assay your server memory requirements you have to understand their meaning.在以检测您的服务器的内存要求,你必须了解他们的意思。
The first thing you have to know is that all the columns (VIRT RES SHR) report memory usage in KB (kilobytes).第一件事,你必须知道的是,所有栏位( virt第SHR )等报告,记忆体使用量在KB (千字节) 。
VIRT column (virtual memory size of the process) means how much memory a particular application has requested, also it counts swapped to the disk memory pages. virt栏(虚拟内存大小的过程中)指多少记忆体特定应用程序的要求,也是计数换到磁盘存储器的页面。 But this field does NOT mean that this process actually uses that amount of memory, to use it for real this memory has to be initiated for example using memset.但这个领域并不意味着这个过程中,其实用途的内存量,用它来真正的记忆,这已被发起的,例如使用memset 。 Generally speaking you can disregard this column.一般来说,您可以忽略此列。
RES column (resident set size, the non-swapped physical memory that a task has used (in kiloBytes)) is the most important one - it actually shows how much physical RAM is allocated for a process.第栏(驻地集的大小,非交换的物理内存的一个专责小组,已使用(千字节) )是其中最重要的-它实际上表明,有多少物理R AM是分配给一个过程。
SHR column says how much memory a particular application is sharing with other applications.自发性高血压大鼠柱说,多少记忆体特定应用程序的共享与其他应用程序。 Eg, most applications in Linux depend on libc, and as every application links with it and uses its functions then this library memory space is mapped to all process simultaneously to conserve memory.例如,大多数应用在Linux依赖于LIBC的,并作为每一个环节的应用与它的用途其职能,然后这个图书馆的内存空间映射到所有的进程,同时为了节约内存。
Consult with this pages for better understanding:谘询与此页面为更好地理解:
1. 1 。 http://tldp.org/LDP/tlk/mm/memory.html http://tldp.org/ldp/tlk/mm/memory.html
2. 2 。 http://www.ibm.com/developerworks/linux/library/l-mem26/