2. amps_sow_dump

amps_sow_dump is a utility used to inspect the contents of a SOW topic store. Additionally it can be used to gather summary statistics on a SOW file.

Options and Parameters

Option Description
filename
Filename of the SOW file.
-n LIMIT Maximum number of records to print per file.
-v, –verbose Print record metadata for records and file summary.
–sizing-chart Print memory sizing chart for efficiency comparison (experimental).
-e, –escape Escape special characters in record data and header.
-d DELIMITER Prints only the record data using the provided ASCII character value as the record delimiter [default: 10 for newline].
–version Show the version number of the program and exit.
-h, –help Show the help message and exit.

Table 2.1: Parameters for amps_sow_dump

Usage

Example 2.1 shows a simple sow dump with the -e flag set to make the header, message and field separators readable. Each key which exists in the order.sow file is dumped out to stdout. This output can easily be redirected to a new file, or piped into another program for further analysis.

This example also uses the -e flag which escapes the special characters. The purpose of this is to simplify the output presented. The field separator used in this example is byte 1 which is replaced with as \x01 by the -e flag.. If this flag was not used, then a non-ascii character would be displayed, making the output harder to read.

tip amps_sow_dump expects a filename at a minimum in order to complete the SOW topic store dump process.
%> ./amps_sow_dump -e ./order.sow

id=0\x01value=1743\x01
id=1\x01value=6554\x01
id=2\x01value=3243\x01
id=3\x01value=5332\x01
id=4\x01value=3725\x01
id=5\x01value=1598\x01
id=6\x01value=6094\x01
id=7\x01value=7524\x01
id=8\x01value=2432\x01
id=9\x01value=9669\x01
id=10\x01value=140\x01

Example 2.1: Example of amps_sow_dump output

Verbose Output

The amps_sow_dump utility also provides for verbose output, which will display more information about the file and its structure in addition to the records contained in the file.

# This is the last record reported by amps_sow_dump for this sample SOW file.
key               = 13480918659780819530
    crc               = 3156974437
    flags             = 0
    file offset       = 4352
    slab offset       = 4096
    allocated         = 128
    data size         = 21
    expiration        = 0
    update            = 0
    generation        = 0
    seq               = 0
    data              = [1=10001
    2=aaaaaaaaaa
    ]


File                : ./sow/order.sow
    Version             : amps-sow-v1.0
    Valid Keys          :                10000
    Record Size         :                  512
    Maximum Records     :                10000
    Multirecords        :                    0
    Maximum record size :                   21
    Average record size :                21.00
    Slab Count          :                    1

    Slab Detail

size          :              5128192
    file offset   :                 4096
    valid count   :                10000
    invalid count :                    0
    stored bytes  :              1280000
    data bytes    :               210000
    deleted bytes :                    0

Example 2.2: amps_sow_dump verbose output

Sizing Chart

Example 2.3 shows the output from the --sizing-chart flag. This is feature can be useful in tuning AMPS memory usage and performance. The Record Size with the asterisk shows the current Record Size setting and allows an AMPS administrator to compare memory usage efficiency along with the potential for a multi-record penalty.

warning This feature is currently listed as experimental, so changing AMPS record size configuration based on the results may not necessarily help performance, and could hurt performance in some cases.
%> ./amps_sow_dump --sizing-chart ./order.sow

=============================================================
   Record Size           Store     Efficiency   Multirecords
=============================================================
 128           128 B        100.00%              0
 256           256 B         50.00%              0
 384           384 B         33.33%              0
 512*          512 B         25.00%              0
 640           640 B         20.00%              0
 768           768 B         16.67%              0
 896           896 B         14.29%              0
1024          1024 B         12.50%              0
1152         1.12 KB         11.11%              0
1280         1.25 KB         10.00%              0
1408         1.38 KB          9.09%              0
1536         1.50 KB          8.33%              0
1664         1.62 KB          7.69%              0
1792         1.75 KB          7.14%              0
1920         1.88 KB          6.67%              0

Example 2.3: Example output for –sizing-chart