29
Jiapeng Xiu [email protected] Chapter 3 Memory Chapter 3 Memory Management Management —— Solaris Memory Monitor

Jiapeng Xiu [email protected] Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

Embed Size (px)

Citation preview

Page 1: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

Jiapeng [email protected]

Chapter 3 Memory ManagementChapter 3 Memory Management

—— Solaris Memory Monitor

Page 2: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

2

Outline

Quick Introduction to Memory Quick Introduction to Memory MonitoringMonitoring

Memory Monitoring ToolsMemory Monitoring ToolsThe Vmstat CommandThe Vmstat CommandMemTool: Unbundled Memory ToolsMemTool: Unbundled Memory ToolsOther Memory ToolsOther Memory Tools

Page 3: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

3

Quick Introduction to Memory MonitoringSolaris memory is used for several

major functions, including the kernel, processes, and the file system cache.

Solaris memory utilization is summarized,at the global level, the following categories: Total physical memory available Memory allocated internally within the Solaris

kernel Memory used for the file system page cache Memory used by processes Memory free

Page 4: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

4

Several Solaris memory utilities Total Physical Memory

Command: prtconf #prtconf

Kernel Memory Command: sar # sar -k 1 1

Page 5: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

5

Free Memory Free memory is almost always zero because the buffer

cache grows to consume free memory. Command:vmstat # vmstat 3

File System Caching Memory The file system cache uses available free memory to

cache files. To look at the amount of file buffer cache, use the

MemTool package. Command:prtmem--summary of the buffer cache

memory #prtmem

Several Solaris memory utilities(Cont.)

Page 6: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

6

Memory Shortage Detection To determine if there is a memory shortage. Command:vmstat

Swap Space Solaris swap space has two important states:

swap reservation and physical swap allocation. Two important measures of Solaris space:

>The amount of virtual swap space that is configured and available for reservations.

>The amount of physical swap space that is configured and available for physical page-outs.

Several Solaris memory utilities(Cont.)

Page 7: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

7

Virtual Swap Space The amount of virtual swap space is the sum

of the amount of physical swap space (disk swap space) plus the amount of memory that Solaris can use for swap.

Command:swap –s #swap -s

Physical Swap Space The amount of physical swap space configured

is simply the amount of physical disk . Command:swap –l

Several Solaris memory utilities(Cont.)

Page 8: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

8

OutlineQuick Introduction to Memory Quick Introduction to Memory

MonitoringMonitoringMemory Monitoring ToolsMemory Monitoring ToolsThe Vmstat CommandThe Vmstat CommandMemTool: Unbundled Memory ToolsMemTool: Unbundled Memory ToolsOther Memory ToolsOther Memory Tools

Page 9: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

9

Memory Monitoring Tools

Many Solaris tools can help us to understand the memory behavior, We have two basic objectives in looking at Solaris memory: to find out where all of the memory

is allocated . to look at memory (or paging)

activity.

Page 10: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

10

Solaris Memory Monitoring CommandsTool Location of Tool Capabilities for Memory

Utilization ReportingPaging Activity

Reporting

vmstat /usr/bin Basic System wide only

ps /usr/bin Process size —

swap /usr/bin Swap allocation —

wsm Engineering/free Working set size —

ipcs /usr/bin SysV shared memory —

MemTool Engineering/download Process/file system cache —

memstat Engineering/download Same as vmstat Breakout of paging for file systems, applications, and libraries

pmap /usr/proc/bin Process address map —

pmap -x /usr/proc/bin Process physical memory utilization, including the amount of memory shared among processes

crash /usr/bin/crash Kernel memory utilities —

dbx SPARCworks Memory leaks —

Page 11: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

11

Outline Quick Introduction to Memory Quick Introduction to Memory

MonitoringMonitoring Memory Monitoring ToolsMemory Monitoring Tools The Vmstat CommandThe Vmstat Command MemTool: Unbundled Memory ToolsMemTool: Unbundled Memory Tools Other Memory ToolsOther Memory Tools

Page 12: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

12

The Vmstat Command

The Solaris vmstat utility summarizes various functions within the virtual memory system, including: systemwide free memory paging counters disk activity system calls CPU utilization

Page 13: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

13

The output of vmstat with explaination

Page 14: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

14

Process Memory Usage, ps, and the pmap CommandThe memory usage of a process can be

categorized into two classes Virtual memory usage Physical memory usage

We refer to the physical memory usage of a process as its resident set size, often abbreviated RSS.

We can use the ps command to display a process's virtual and physical memory usage.

Page 15: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

15

Process Memory Usage, ps, and the pmap Command (Cont.)Example:

# ps -e -opid,vsz,rss,args PID VSZ RSS COMMAND 11896 1040 736 ps -a -opid,vsz,rss,args 11892 1032 768 sh 3603 1032 768 sh 2695 1896 1432 telnet donan 2693 1920 1456 telnet donan 2433 1920 1440 telnet firefly 3143 1920 1456 telnet devnull 2429 1920 1440 telnet firefly.eng 2134 1920 1440 telnet devnull

Page 16: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

16

Process Memory Usage, ps, and the pmap Command (Cont.)The memory use is separated into

three categories: Private, shared and partially shared.

The pmap command provides a mechanism for a detailed look at a process’s memory utilization. how much memory is residenthow much of that is sharedhow much private memory a process has

Page 17: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

17

Outline Quick Introduction to Memory Quick Introduction to Memory

MonitoringMonitoring Memory Monitoring ToolsMemory Monitoring Tools The Vmstat CommandThe Vmstat Command MemTool: Unbundled Memory MemTool: Unbundled Memory

ToolsTools Other Memory ToolsOther Memory Tools

Page 18: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

18

Unbundled Memory Tools

MemTool was developed to provide a more in-depth look at where memory has been allocated on a Solaris system.

Using these tools, we can find out where every page of memory is, and in what proportions.

Page 19: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

19

MemTool Utilities • The MemTool package provides command-line, GUI,

and character tools, as listed in Table.

Tool Interface Description

memps CLI Dumps process summary and file system cache memory (-m).

prtmem CLI Displays a systemwide summary of memory allocation.

prtswap CLI Displays a systemwide detailed description of swap

allocation. Both virtual and physical swap allocation are

shown.

memtool GUI Is a comprehensive GUI for UFS and process memory.

mem CUI Is a Curses interface for UFS and process memory.

Page 20: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

20

Command-Line Tools

System Memory Summary: prtmem Show a systemwide summary of memory

utilization, categorized into seven major groups. # prtmem Total memory: 241 Megabytes Kernel Memory: 39 Megabytes Application: 106 Megabytes Executable & libs: 36 Megabytes File Cache: 3 Megabytes Free, file cache: 58 Megabytes Free, free: 0 Megabytes

Page 21: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

21

Command-Line Tools (Cont.)

File System Cache Memory: memps -m Memtool provides a list showing where the pool

of filesystem cache memory has been allocated, sorted by vnode. # memps -m SunOS devhome 5.7 SunOS_Development sun4u

02/08/100 00:23:12 Size E/F Filename 10232k E /export/ws/local/netscape/netscape 5648k E

/export/ws/dist/share/framemaker,v5.5.3/bin/sunxm.s5.sparc/maker5X.e

2944k F /home/rmc/.netscape/history.dat

Page 22: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

22

Command-Line Tools (Cont.)The prtswap utility shows the three main states

of swap and the way in which that state affects the virtual and physical swap configured.

Page 23: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

23

The MemTool GUI

The MemTool GUI provides an easy method for invoking most of the functionality of the MemTool command line interfaces. Invoke the GUI as the root user to see all of the process and file information.

The MemTool GUI offers three basic modes: buffer cache memory process memory process/buffer cache mapping matrix.

Page 24: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

24

The MemTool GUI (Cont.)

The initial screen shows the contents of the file system cache, including each entry in the UFS file system cache.

The second mode of the MemTool GUI is the process memory display which shows the process table with a memory summary for each process.

The process matrix shows the relationship between processes and mapped files. The matrix can be used to show the total memory usage of a group of processes.

Page 25: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

25

Outline Quick Introduction to Memory Quick Introduction to Memory

MonitoringMonitoring Memory Monitoring ToolsMemory Monitoring Tools The Vmstat CommandThe Vmstat Command MemTool: Unbundled Memory MemTool: Unbundled Memory

ToolsTools Other Memory ToolsOther Memory Tools

Page 26: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

26

The Workspace Monitor Utility: WSM The wsm command is invoked against a

single process.It shows a live status of a processes

memory map and lists the amount of memory that has been read or written to in the sampled interval.

This information is particularly useful for determining how much memory a process is using at any given instant.

# wsm -p 732 -t 10

Page 27: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

27

An Extended vmstat Command: memstat memstat shows the paging activity,

page-ins, page-outs, and page-frees separated into three classes: file system paging anonymous memory pagingexecutable/shared library paging

Page 28: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

28

An Extended vmstat Command: memstat (Cont.)

Page 29: Jiapeng Xiu media@bupt.edu.cn Chapter 3 Memory Management Chapter 3 Memory Management —— Solaris Memory Monitor

29

End

[email protected]