Monitoring Memory Usage On Aix: Key Strategies And Techniques

how to monitor memory usage in aix

Monitoring memory usage in AIX can be done using various tools and commands. Some of the most commonly mentioned tools are svmon, vmstat, nmon, and topas. Each of these tools provides different insights into memory usage, allowing administrators to check memory consumption, identify over-commitment, and analyse memory allocation.

For example, the command 'svmon -G' can be used to determine the actual memory consumption of a server, while 'vmstat -Itw' displays virtual memory usage. 'nmon' can quickly show big uses of memory, and 'topas' presents memory usage in an easy-to-understand format.

Additionally, there are other tools like BMC Patrol and Nagios that can provide automated alerts when certain memory thresholds are reached.

shundigital

Using the svmon command

The svmon command is a useful tool for monitoring memory usage in AIX. It provides a comprehensive overview of memory utilisation, including real, virtual, and paging space memory used.

To get a global view of memory utilisation on your host, you can use the svmon command with the -G flag:

Bash

Svmon -G

This will display the following information:

  • Size: The total size of RAM in 4k pages.
  • Inuse: The pages in RAM used by processes, plus the number of persistent pages that belonged to a terminated process and are still resident in RAM.
  • Free: The amount of pages on the free list.
  • Pin: The number of pages pinned in physical memory (RAM). This cannot be paged out.
  • Virtual: The actual use of paging space (in 4k pages).
  • Available: The amount of "available" memory on the system.

Additionally, you can use the ps command in conjunction with svmon to identify the offending processes that are consuming a lot of memory. The ps command provides information about the processes running on your system, including their memory usage.

To display memory statistics for a specific process, you can use the following command:

Bash

Svmon -P PID

Where PID is the process ID of the process you want to monitor.

Furthermore, you can also use the svmon command to determine the actual memory consumption of a server. For example, to calculate the memory consumption as a percentage, you can divide the memory-virtual value by the memory-size value:

Bash

Svmon -G

Bc scale=2 memory-virtual/memory-size

This will give you the percentage of memory consumption. It is recommended to keep the memory consumption below 90%. Above that, you may start seeing paging activity and it is advisable to either lower the load on the system or add more memory.

In summary, the svmon command is a versatile and powerful tool for monitoring memory usage in AIX. It provides detailed insights into memory utilisation and can help identify processes that are consuming a significant amount of memory. By using svmon in combination with other commands such as ps and vmstat, administrators can effectively manage and optimise memory usage on their AIX systems.

shundigital

Using the nmon command

Nmon, short for "Nigel's Monitor", is a command-line tool that presents performance information about the system to the user. It can be used to monitor memory usage in AIX.

To use nmon to monitor memory usage, simply type "nmon" at the prompt, and it will bring up a curses interface with a "help" screen listing the available options. From there, you can press "m" to display memory information. This will show you a few big uses of memory, including computational memory and system memory.

Computational memory can be calculated by adding up the Process and System values. For example, if Process=6.0% and System=16.2%, then the computational memory=22.2%.

It's important to note that the Used percentage displayed by nmon includes both computational and non-computational memory. Therefore, you cannot confirm memory over-commitment solely based on nmon. To check for memory over-commitment, you need to calculate the virtual memory usage, which is the computational memory.

Nmon also provides information on virtual memory stats, such as total and free memory (RAM), page size, free memory percentages, memory usage stats, and more.

By utilising nmon's on-screen display and CSV output options, you can monitor memory usage in real-time and also capture data for further analysis in a spreadsheet.

shundigital

Using the vmstat command

The vmstat command (short for virtual memory statistics) is a built-in monitoring utility in Linux. The command is used to obtain information about memory, system processes, paging, interrupts, block I/O, disk, and CPU scheduling. The basic vmstat syntax is:

Vmstat [options][delay [count]]

The various components of the syntax are:

  • Options – various switches to customize the output.
  • Delay – defines the time elapsed between output updates.
  • Count – the number of output updates after the specified delay interval. If count isn’t set, the default value is infinite.

The list of available options includes:

  • `-a`: Displays active and inactive memory.
  • `-f`: Displays the number of forks since boot.
  • `-m`: Displays slab statistics.
  • `-s`: Displays the header only once rather than periodically.
  • `-d`: Displays a table of various event counters and memory statistics.
  • `-D`: Displays disk statistics.
  • `-p`: Displays detailed disk activity report.
  • `-P`: Displays detailed partition statistics.
  • `-t`: Adds a timestamp to the report.
  • `-S`: Switches output units.
  • `-V`: Displays version information.
  • `-h`: Displays a user manual in the terminal.

The basic output of the vmstat command displays system information in six sections:

Procs – Process Statistics:

  • `r` – Active process count.
  • `b` – Sleeping process count.

Memory – Memory statistics:

  • `swpd` – Total virtual memory.
  • `free` – Total free memory.
  • `buff` – Total memory temporarily used as a data buffer.
  • `cache` – Total cache memory.

Swap – Swap space Statistics:

  • `si` – The rate of swapping-in memory from disk.
  • `so` – The rate of swapping-out memory to disk.

Io – Input/Output Statistics:

  • `bi` – Blocks received from a block device per second.
  • `bo` – Blocks sent to a block device per second.

System – Scheduling statistics:

  • `in` – The number of system interrupts.
  • `cs` – The number of context switches per second.

Cpu – CPU Statistics:

  • `us` – The percentage of CPU time spent on non-kernel processes.
  • `sy` – The percentage of CPU time spent on kernel processes.
  • `id` – The percentage of idle CPU.
  • `wa` – The percentage of CPU time spent waiting for Input/Output.
  • `st` – The percentage of CPU time stolen by a virtual machine.

Using the `-a` option replaces the `buff` and `cache` memory columns with `inact` and `active` columns, which display the amount of inactive and active memory in a system.

To generate more detailed information about memory, event counters, and CPU scheduling statistics, you can run the following command:

Vmstat -d -m -s

The output of this command will include four sections:

Memory:

  • Total physical memory.
  • Currently used memory.
  • Swap memory information.

CPU:

  • Non-nice CPU ticks – the number of times the CPU was used for high-priority processes.
  • Nice CPU ticks – the number of times the CPU was used for lower-priority processes.
  • System CPU ticks – the number of times the CPU was used for kernel processes.
  • Idle CPU ticks – the number of times the CPU was idle.
  • IO-wait – the number of times the CPU was used for input/output management.
  • IRQ – the number of times the CPU received interrupt requests.
  • Softirq – the number of times the CPU received software interrupts.
  • Stolen CPU ticks – the number of times a virtual machine stole CPU time.

Paging:

  • Total pages paged in from virtual memory.
  • Total pages paged out to virtual memory.
  • Total pages read from swap memory.
  • Total pages written to swap memory.

Event counters:

  • The number of interrupts since boot.
  • The number of context switches performed.
  • The timestamp for the last boot time.
  • The total number of forks.

The `-D` option generates a quick summary statistic of all disk activity, while the `-d` option provides a detailed statistic on each disk usage. The `-p` option generates a report related to a specific partition, and the `-t` option adds a timestamp to the requested output.

The default unit for displaying memory and swap statistics is kilobytes. To change the output units, use the `-S` option with the desired argument: `k` for decimal kilobytes, `m` for megabytes, `K` for hexadecimal kilobytes, or `M` for megabytes.

shundigital

Using the ipcs -m command

The ipcs command reports the status of interprocess communication facilities. By default, it shows information about all three resources: shared memory segments, message queues, and semaphore arrays. The ipcs -m command specifically writes information about active shared memory segments.

When you run the ipcs -m command, you will see details about the shared memory used by various applications. The output will include columns such as the identifier for the facility entry, the key used to access the shared memory segment, the access modes and flags, the owner and group of the facility entry, and the size of the shared memory segment.

Shared Memory:

M 65537 0x00000000 DCrw------- root system

M 720898 0x00010300 -Crw-rw-rw- root system

M 65539 0x00000000 DCrw------- root system

In this output, we can see that each shared memory segment is identified by a unique key and has associated access modes, an owner, and a size. For example, the first segment has a key of "0x00000000", is owned by "root system", and has a size of "65537".

The ipcs -m command is a useful tool for system administrators to monitor and manage memory usage in AIX. It provides detailed information about the shared memory segments, which can help identify memory usage and potential bottlenecks or issues.

shundigital

Using the topas command

The TOPAS command is used for online monitoring of memory usage in AIX systems. When the command is run, it publishes dynamic output on-screen that updates every 2 seconds. The information available from TOPAS includes kernel, user, wait, RAM, processes, CPU, NFS, and disk allocation data.

To list all processes individually, use the following command:

> # topas -P

To list all disk information individually, use the following command:

> # topas -D

To quit the TOPAS output, use the q command:

> # q

The TOPAS command can also be used to check CPU usage for each process. There are many different TOPAS commands that system administrators can use to check CPU usage.

To check memory usage for each process utilising high CPU, run the following command:

> # topas

This will show memory usage for each command.

Frequently asked questions

The svmon command is the most comprehensive tool for this. You can also get a summary with memory shown in MB using svmon -P -O summary=basic,unit=MB.

Look at the in-use clnt+pers pages in the svmon -G output if you want to know all file cache, or look at vmstat -v and look at "file pages" for file cache excluding executables.

You can use Resource Monitoring and Control (RMC), which comes with AIX, or BMC Patrol. You can also use vmstat lparstat topas nmon sar mpstat svmon.

Written by
Reviewed by
Share this post
Print
Did this article help you?

Leave a comment