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信息共享內存,緩衝區,緩存內存和交換空間使用的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無米比較五日

The command will activate continuous polling delay at 5 seconds apart, and then display memory status in megabytes on terminal.該命令將持續激活投票站延遲5秒,然後顯示記憶體的地位兆字節的終端。 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開關就會顯示一行總數的物理內存和交換空間。

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的輔助

ps command reports a snapshot on information of the current active processes. ps的命令報告的快照信息當前活躍的進程。 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. ps的將顯示與記憶的資源,所使用的每一個進程或任務運行的系統。 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

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.在這些虛擬化系統,對內存的使用信息已經被計算出來的控制面板或/進程/ 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 我的數字生活論壇 .



One Response to “How to Check Memory Usage in Linux based Server”一對“如何檢查記憶體使用量在基於Linux的服務器”

  1. Artem S. Tashkinov阿爾喬姆第Tashkinov
    September 24th, 2007 15:20 2007年9月24日15:20
    1

    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水庫自發性高血壓大鼠)報告記憶體使用量以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.水庫欄(駐留集大小,非交換物理內存的任務使用(以千字節) )是最重要的是-它實際上表明有多少物理內存是分配給一個進程。

    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
    2. 2 。 http://www.ibm.com/developerworks/linux/library/l-mem26/

Leave a Reply留下一個回复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤: href="" title="">的<a <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> “刪除日期時間= “ ” “的<em> <i> <q cite=""> <strike>的<strong>

Subscribe without commenting訂閱沒有評論


Custom Search

New Articles新文章

Incoming Search Terms for the Article收到的搜索字詞的文章

linux memory usage Linux的記憶體使用量 - - linux memory stats Linux的記憶體統計 - - CentOS memory usage CentOS內存使用情況 - - linux show memory Linux系統顯示內存 - - linux memory size Linux的內存大小 - - Linux memory status Linux的記憶體地位 - - linux top memory Linux的最大記憶體 - - ubuntu show memory Ubuntu的顯示記憶體 - - linux check memory usage Linux的檢查記憶體使用量 - - linux check resources Linux的檢查資源 - - ubuntu show memory usage Ubuntu的顯示內存使用情況 - - ubuntu check memory Ubuntu的檢查內存 - - linux check memory Linux的記憶體檢查 - - memory usage linux 內存使用Linux操作系統 - - linux memory usage report Linux系統內存使用報告 - - ubuntu check memory usage Ubuntu的檢查內存使用情況 - - linux check memory status Linux的記憶體狀況檢查 - - show memory linux 顯示記憶體的Linux - - checking memory usage on linux 檢查記憶體使用量在Linux上 - - top command memory usage 頂端命令內存使用 - - how to check memory in linux 如何檢查內存在Linux - - linux real memory usage Linux的真正的內存使用情況 - - plesk memory usage plesk內存使用情況 - - linux show swap usage Linux系統顯示互換使用 - - unix memory usage 尤尼克斯記憶體使用量 - - ubuntu server memory usage Ubuntu的服務器內存使用情況 - - linux check processes Linux的檢查過程 - - linux physical memory usage Linux系統物理內存使用情況 - - linux memory statistics Linux的記憶體統計 - - unix memory status 尤尼克斯記憶地位 - - how to check memory status in linux 如何檢查記憶體的地位在Linux - - Linux ps show memory Linux系統的ps顯示內存 - - linux check resource usage Linux的檢查資源使用 - - linux show physical memory Linux系統顯示物理內存 - - check memory usage ubuntu 檢查內存使用Ubuntu的 - - linux check process Linux的檢查過程 - - check memory usage linux 檢查內存使用Linux操作系統 - - ps show memory usage ps的顯示內存使用情況 - - linux memory stat Linux的記憶體狀態 - - check memory status in linux 檢查記憶體的地位在Linux - - checking memory in unix 檢查內存在Unix - - top memory linux 最大記憶體的Linux - - ps show memory ps的顯示記憶體 - - linux top memory Linux的最大記憶體 - - show physical memory linux 顯示物理內存的Linux - - show memory in linux 顯示內存在Linux - - checking memory in linux 檢查內存在Linux - - Linux ps memory size Linux的ps的內存大小 - - all 全部 - - unix ps show memory usage 尤尼克斯的ps顯示內存使用情況 - - linux check memory process Linux的記憶過程檢查 - - ps display memory usage ps的顯示內存使用情況 - - show memory usage ubuntu 顯示內存使用Ubuntu的 - - top virt column 頂端virt欄 - - linux application memory usage Linux應用軟件的內存使用情況 - - linux memory info Linux的內存信息 - - check memory on linux 檢查內存在Linux上 - - linux display memory size Linux系統顯示內存大小 - - linux check memory size Linux的檢查內存大小 - - linux top virt Linux的頂端virt - - linux show memory status Linux的記憶體狀態顯示 - - show memory usage linux 顯示內存使用Linux操作系統 - - linux show memory size Linux系統顯示內存大小 - - check memory linux 檢查內存的Linux - - linux+check process+memory Linux系統+檢查過程+內存 - - linux show memory usage Linux系統顯示內存使用情況 - - top command virt 頂端命令virt - - check memory in linux 檢查內存在Linux - - linux memory report Linux的記憶體報告 - - linux ps memory usage Linux的記憶體使用量的ps - - ubuntu check ram size Ubuntu的檢查RAM大小 - - checking the amount of memory on a Linux server 檢查的內存量的Linux服務器 - - linux command to check memory status Linux命令來檢查記憶體狀態 - - check ram on linux 檢查內存在Linux上 - - linux report memory usage Linux系統內存使用報告 - -