Tech Tip: GSS-0045

Last Updated June 29, 2016

applies to GemStone/S 64 Bit 3.2.x and earlier and 32-bit GemStone/S

As your GemStone repository grows over time, the question may arise about which objects are using that space and how many of them there are, and which classes the objects are. The transparency that makes persistence simple can make it more difficult to see the relationship to the number and classes of objects. There are a number of ways to examine the contents of your repository.

GsObjectInventory

In GemStone/S 64 Bit versions 2.0 and later, the GsObjectInventory class provides a way to scan your repository and produce a number of reports on the number of instances of all classes in the repository. This performs a scan of the entire repository, which takes some time in larger systems.
For example:

topaz 1> run
GsObjectInventory profileRepository instanceCountReportDownTo:  200
%
 *** GsObjectInventory instanceCountReport printed at: 28/06/2016 11:14:56 ***  
Hidden classes are included in this report.
________________________________________________________________________________
Class                                                   Instances          Bytes
________________________________________________________________________________
String                                                      45055       11956544
Array                                                       26755        4140640
GsNMethod                                                   22387        4483000
Symbol                                                      19790         881816
SymbolAssociation                                            5230         209840
SymbolSet                                                    4539         152552
GsMethodDictionary                                           3420        1793624
SupportedConfiguration                                       3417         382704
ExecBlock                                                    3319         212728
OsConfiguration                                              2396         210864
CanonStringBucket                                            2017         304280
Class                                                        1676         261688
IdentityKeyValueDictionary                                   1537         209096
IdentityCollisionBucket                                      1418         152296
SymbolDictionary                                              887         151112
ClassHistory                                                  837          40400
ByteArray                                                     782          26232
CCallout                                                      762          73152
DepListBucket                                                 751          42064
DateTime                                                      708          39728
ClientSmalltalkConfiguration                                  525          33624
TimeZoneTransition                                            313          17560
________________________________________________________________________________

ScanBackup

ScanBackup is a tool that allows you to read and parse a backup file to produce an instance count of the objects that were written to the backup file. This code is provided as a filein here.

This code works in 32-bit GemStone/S (tested on v6.7), as well as GemStone/S 64 bit 2.x, 3.1.x and 3.2.x.

To use, file in ScanBackup.gs and commit. Then execute the following, using the appropriate class depending on if you are in 32-bit GemStone/S or GemStone/S 64 bit.

API in GemStone/S 64-bit
ScanBackup64 scanBackupAtServerPath: 'path-to-backup-file'

32-bit GemStone/S:
ScanBackup32 scanBackupAtServerPath: 'path-to-backup-file'

For example:

topaz 1> run
SystemRepository fullBackupTo: 'bkup.dat'
%
true
topaz 1> run
ScanBackup64 scanBackupAtServerPath: 'bkup.dat'
%
1       45055   String
2       26755   Array
3       22387   GsNMethod
4       19790   Symbol
5       5230    SymbolAssociation
6       4539    SymbolSet
7       3420    GsMethodDictionary
8       3417    SupportedConfiguration
9       3319    ExecBlock
10      2396    OsConfiguration
11      2017    CanonStringBucket
12      1537    IdentityKeyValueDictionary
13      1418    IdentityCollisionBucket
14      887     SymbolDictionary
15      838     Metaclass3
16      837     ClassHistory
17      782     ByteArray
18      762     CCallout
19      751     DepListBucket
20      708     DateTime
21      525     ClientSmalltalkConfiguration
22      313     TimeZoneTransition
23      195     Association
24      150     CPreprocessorToken
25      106     EqualityCollisionBucket

It is not strictly required to execute this in the same environment as the backup, however, class OOPs in the backup file are translated to class names based on the current image and may be incorrect for non-kernel classes in an unrelated repository, or a different GemStone product.

Obex

Obex (Object Explorer) is a open-source project that allows you to visualize objects within the repository and interactively explore the contents. This project is currently under active development. See the obex project page on github for current status.

As an example of the design of this set of tools, this diagram shows object counts and the class and number of in instances that reference those objects:

Obex visualization