Application execution over a range of memory sizes with the rmss command

As a driver program, the rmss command executes a specified application over a range of memory sizes and displays statistics describing the application's performance at each memory size.

The -s, -f, -d, -n, and -o flags of the rmss command are used in combination to invoke the rmss command as a driver program. The syntax for this invocation style of the rmss command is as follows:
rmss [ -s smemsize ] [ -f fmemsize ] [ -d memdelta ]
     [ -n numiterations ] [ -o outputfile ] command

Each of the following flags is discussed in detail below. The -s, -f, and -d flags are used to specify the range of memory sizes.

-n
This flag is used to specify the number of times to run and measure the command at each memory size.
-o
This flag is used to specify the file into which to write the rmss report, while command is the application that you wish to run and measure at each memory size.
-s
This flag specifies the starting size.
-f
This flag specifies the final size.
-d
This flag specifies the difference between sizes.
All values are in integer or decimal fractions of megabytes. For example, if you wanted to run and measure a command at sizes 256, 224, 192, 160 and 128 MB, you would use the following combination:
-s 256 -f 128 -d 32
Likewise, if you wanted to run and measure a command at 128, 160, 192, 224, and 256 MB, you would use the following combination:
-s 128 -f 256 -d 32

If the -s flag is omitted, the rmss command starts at the actual memory size of the machine. If the -f flag is omitted, the rmss command finishes at 8 MB. If the -d flag is omitted, there is a default of 8 MB between memory sizes.

What values should you choose for the -s, -f, and -d flags? A simple choice would be to cover the memory sizes of systems that are being considered to run the application you are measuring. However, increments of less than 8 MB can be useful, because you can get an estimate of how much space you will have when you settle on a given size. For instance, if a given application thrashes at 120 MB but runs without page-ins at 128 MB, it would be useful to know where within the 120 to 128 MB range the application starts thrashing. If it starts at 127 MB, you may want to consider configuring the system with more than 128 MB of memory, or you may want to try to modify the application so that there is more space. On the other hand, if the thrashing starts at 121 MB, you know that you have enough space with a 128 MB machine.

The -n flag is used to specify how many times to run and measure the command at each memory size. After running and measuring the command the specified number of times, the rmss command displays statistics describing the average performance of the application at that memory size. To run the command 3 times at each memory size, you would use the following:
-n 3
If the -n flag is omitted, the rmss command determines during initialization how many times your application must be run to accumulate a total run time of 10 seconds. The rmss command does this to ensure that the performance statistics for short-running programs will not be significantly skewed by outside influences, such as daemons.
Note: If you are measuring a very brief program, the number of iterations required to accumulate 10 seconds of CPU time can be very large. Because each execution of the program takes a minimum of about 2 elapsed seconds of rmss overhead, specify the -n parameter explicitly for short programs.

What are good values to use for the -n flag? If you know that your application takes much more than 10 seconds to run, you can specify -n 1 so that the command is run twice, but measured only once at each memory size. The advantage of using the -n flag is that the rmss command will finish sooner because it will not have to spend time during initialization to determine how many times to run your program. This can be particularly valuable when the command being measured is long-running and interactive.

It is important to note that the rmss command always runs the command once at each memory size as a warm-up before running and measuring the command. The warm-up is needed to avoid the I/O that occurs when the application is not already in memory. Although such I/O does affect performance, it is not necessarily due to a lack of real memory. The warm-up run is not included in the number of iterations specified by the -n flag.

The -o flag is used to specify a file into which to write the rmss report. If the -o flag is omitted, the report is written into the file rmss.out.

Finally, command is used to specify the application to be measured. It can be an executable program or shell script, with or without command-line arguments. There are some limitations on the form of the command however. First, it cannot contain the redirection of input or output (for example, foo > output or foo < input). This is because the rmss command treats everything to the right of the command name as an argument to the command. To redirect, place the command in a shell script file.

Usually, if you want to store the rmss output in a specific file, use the -o option. If you want to redirect the standard output of the rmss command (for example, to concatenate it to the end of an existing file) then use the Korn shell to enclose the rmss invocation in parentheses, as follows:
# (rmss -s 24 -f 8 foo) >> output