290 likes | 477 Views
Chapter 3 Memory Management —— Solaris Memory Monitor. Jiapeng Xiu media@bupt.edu.cn. Outline. Quick Introduction to Memory Monitoring Memory Monitoring Tools The Vmstat Command MemTool: Unbundled Memory Tools Other Memory Tools. Quick Introduction to Memory Monitoring.
E N D
Chapter 3 Memory Management—— Solaris Memory Monitor • Jiapeng Xiu • media@bupt.edu.cn
Outline • Quick Introduction to Memory Monitoring • Memory Monitoring Tools • The Vmstat Command • MemTool: Unbundled Memory Tools • Other Memory Tools
Quick Introduction to Memory Monitoring • Solaris 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
Several Solaris memory utilities • Total Physical Memory • Command: prtconf • #prtconf • Kernel Memory • Command: sar • # sar -k 1 1
Several Solaris memory utilities(Cont.) • 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.) • 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.) • 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
Outline • Quick Introduction to Memory Monitoring • Memory Monitoring Tools • The Vmstat Command • MemTool: Unbundled Memory Tools • Other Memory Tools
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.
Outline • Quick Introduction to Memory Monitoring • Memory Monitoring Tools • The Vmstat Command • MemTool: Unbundled Memory Tools • Other Memory Tools
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
Process Memory Usage, ps, and the pmap Command • The 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.
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
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 resident • how much of that is shared • how much private memory a process has
Outline • Quick Introduction to Memory Monitoring • Memory Monitoring Tools • The Vmstat Command • MemTool: Unbundled Memory Tools • Other Memory Tools
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.
MemTool Utilities • The MemTool package provides command-line, GUI, and character tools, as listed in Table.
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
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
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.
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.
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.
Outline • Quick Introduction to Memory Monitoring • Memory Monitoring Tools • The Vmstat Command • MemTool: Unbundled Memory Tools • Other Memory Tools
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
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 paging • executable/shared library paging
End • Last.first@Sun.COM