How to determine storage usage per set using hist-dump command

FAQ How to determine storage usage per set using hist-dump command

This article describes the procedure to compute storage size usage per set using the hist-dump command. Note that the hist-dump command is deprecated as of server version 4.2.0.2. Refer to the How to determine storage per set article for the newer versions which use the histogram info command.

Method

The following example describes the steps to compute storage usage per set using the hist-dump info command. Note that this computation needs to be done on each node individually as hist-dump tracks only master records. The final value from each node must be added and multiplied by the replication factor to get the set’s total storage usage across the cluster.

Formula to be used:

 ​​​NUM_BUCKETS
 Σ             number_of_records_in_bucket * rblock_size * N
 N=0

For this example, let’s write the following set of records into Aerospike DB:

  1. 100 records with 256 bytes each.
  2. 500 records with 512 bytes each.
  3. 500 records with 1 KiB each.
  4. 1000 records with 2 KiB each.

Total records = 2100.

Run hist-dump command with hist=objsz

asinfo -v "hist-dump:ns=<namespaceName>;set=<setName>;hist=objsz"

Output:

Admin> asinfo -v "hist-dump:ns=test;set=testset;hist=objsz" -l
172.17.0.3:3000 (172.17.0.3) returned:
test:objsz=100,1,0,0,0,53,0,258,0,0,0,259,0,0,0,0,0,0,0,488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

172.17.0.4:3000 (172.17.0.4) returned:
test:objsz=100,1,0,0,0,47,0,242,0,0,0,241,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Output format

This command returns object size histogram with the following format:

NAMESPACE:HISTOGRAM=NUM_BUCKETS,BUCKET_WIDTH,BUCKET_0,BUCKET_1,... 

Where:
HISTOGRAM is objsz
​​​NUM_BUCKETS is 100
BUCKET_WIDTH is 1 by default and indicates one rblock (Record Block) which as of is 128 bytes. The bucket width value can be increased by changing obj-size-hist-max value. 

BUCKET_0 represents the number of master records fitting in more than 0 rblocks and strictly under 1 * BUCKET_WIDTH rblock(s). Since no records can fit into a number of rblocks stricly less 1 (which can only be 0 rblock), with the default obj-size-hist-max, BUCKET_0 is always 0. 

BUCKET_1 represents the number of master records fitting in more than 1 * BUCKET_WIDTH rblock(s) and stricly less than 2 * BUCKET_WIDTH rblocks.
........
........
BUCKET_99 represents the number of master records fitting in more than 99 * BUCKET_WIDTH rblocks.

Computation:

  1. rblock_size is 128 bytes in server version prior to 4.2.
  2. NUM_BUCKETS is 100.
  3. BUCKET_WIDTH can be controlled using obj-size-hist-max (default: 100). Each bucket has a width or size of rblock * obj-size-hist-max/100

NOTE: If the last bucket has a non zero number of records (records greater than ~12.5KiB), it would be necessary to increase the obj-size-hist-max and wait for an nsup cycle to complete in order to make sure the total range of object sizes in the namespace is covered. obj-size-hist-max can be used to increase the BUCKET_WIDTH (but will lower the resolution of the histogram).
Admin> asinfo -v "set-config:context=namespace;id=test;obj-size-hist-max=200"

From NODE 172.17.0.3:

53 * 128 * 3 = 20352 bytes
258 * 128 * 5 = 165120 bytes
259 * 128 * 9 = 298368 bytes
488 * 128 * 17 = 1061888 bytes

Sum = 1545728 bytes ~= 1.474 MB

From NODE 172.17.0.4:

47 * 128 * 3 = 18048 bytes
242 * 128 * 5 = 154880 bytes
241 * 128 * 9 = 277632 bytes
512 * 128 * 17 = 1114112 bytes

Sum = 1564672 bytes ~= 1.492 MB

Total sum of both the nodes = 1545728 + 1564672 = 3110400 ~= 2.966M Overall usage including replica copies = 3110400 * 2 = 6220800 ~= 5.932M

Admin> info namespace 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Namespace Information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Namespace                Node   Avail%   Evictions                 Master                Replica     Repl     Stop             Pending       Disk    Disk     HWM          Mem     Mem    HWM      Stop   
        .                   .        .           .   (Objects,Tombstones)   (Objects,Tombstones)   Factor   Writes            Migrates       Used   Used%   Disk%         Used   Used%   Mem%   Writes%   
        .                   .        .           .                      .                      .        .        .             (tx,rx)          .       .       .            .       .      .         .   
bar         172.17.0.4:3000     N/E        0.000     (0.000,  0.000)        (0.000,  0.000)        2        false    (0.000,  0.000)          N/E   N/E     50        0.000 B    0       60     90        
bar         85fdb77acd17:3000   N/E        0.000     (0.000,  0.000)        (0.000,  0.000)        2        false    (0.000,  0.000)          N/E   N/E     50        0.000 B    0       60     90        
bar                                        0.000     (0.000,  0.000)        (0.000,  0.000)                          (0.000,  0.000)     0.000 B                      0.000 B                             
test        172.17.0.4:3000     99         0.000     (1.042 K, 0.000)       (1.058 K, 0.000)       2        false    (0.000,  0.000)     2.966 MB   1       50      131.250 KB   1       60     90        
test        85fdb77acd17:3000   99         0.000     (1.058 K, 0.000)       (1.042 K, 0.000)       2        false    (0.000,  0.000)     2.966 MB   1       50      131.250 KB   1       60     90        
test                                       0.000     (2.100 K, 0.000)       (2.100 K, 0.000)                         (0.000,  0.000)     5.933 MB                   262.500 KB                            
Number of rows: 6


Admin> show statistics namespace like device_used_bytes 
~~~~~~~~~~~~~~~test Namespace Statistics~~~~~~~~~~~~~~~~
NODE             :   172.17.0.4:3000   85fdb77acd17:3000   
device_used_bytes:   3110400           3110400  

For this example, all the objects were written for namespace="test" and set="testset" only, so let’s match the computed value with sum of device_used_bytes from both the nodes for the namespace=test. Total device_used_bytes (adding both the nodes) = 3110400 + 3110400 = 6220800 ~= 5.932M The value matches exactly with the calculated value using object size histogram (hist-dump command).

Notes

  • The hist-dump command is deprecated as of 4.2 server version. Use the histogram command for server versions 4.2 and above.
  • Records are stored in 16 bytes increments (rblock_size) as of version 4.2, and 128 bytes prior to that.

Keywords

OBJECT SIZE HISTOGRAM SET STORAGE SIZE HIST-DUMP OBJSZ

Timestamp

June 2019

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.