HCL Commerce Version or later

hcl-cache-rdb utility

The hcl-cache-rdb utility consumes a Redis RDB file. RDB files are point-in-time snapshots of the Redis memory contents, and are used for replication and fail-over.

Note: For more information about Redis RDB files, see Redis Persistence.

The utility parses the contents of a Redis RDB file and generates a report that is useful for tuning and troubleshooting.

The information in the report includes:
  • List of caches found, with number of entries and estimated size in MB (footprint)
  • Histogram analysis of:
    • Cache entry footprints (size in bytes)
    • Time to expiry
    • Idle time
  • Top cache entries by size
  • Top dependencies by Size

Obtaining an RDB file

If your Redis server is already configured with RDB persistence (CONFIG SAVE GET), RDB files are already generated at the configured intervals. The dump.rdb file can be found under the /data directory in the container.

You can also request RDB files on demand by using the SAVE and BGSAVE commands.

The SAVE command is synchronous. Because file generation can take a few seconds, the Redis server might become unavailable and be restarted.

The BGSAVE command is asynchronous and does not block the Redis server. The Redis log (kubectl logs) will include information for when background saves are started and completed:
1:M 23 Jun 2021 14:23:31.568 * Background saving started by pid 3763
3763:C 23 Jun 2021 14:23:32.921 * DB saved on disk
3763:C 23 Jun 2021 14:23:32.926 * RDB: 5 MB of memory used by copy-on-write
1:M 23 Jun 2021 14:23:33.001 * Background saving terminated with success

Running the hcl-cache-rdb utility

The utility can be started by using the hcl-cache-rdb.sh script. An error will be displayed if the RDB file is not found.

The size of the heap available to the utility is constrained by the container limits. The available size is printed during startup: (e.g. INFO: -Xmx 1536mb).

When parsing large RDB files, it is possible that the utility fails with OutOfMemory error. In that case you can increase the size of the container, manually specify a new -Xmx limit, or copy the utility to a separate environment that can run Java Version 8 or later.

Running the utility on a separate environment is also recommended to avoid having to copy the RDB files into the container.


java -jar rdbparser.jar parameters

Parameter values

-c,--cache arg
Cache name. Defaults to all.
-f,--file arg
RDB file. Defaults to dump.rdb in current directory.
Prints this help.
-k,--key arg
Dumps keys that contain the parameter. In this mode the report is not shown.
-n,--namespace arg
Namespace. Defaults to all.