Database Blocks Explorer for InterSystems IRIS/Caché
- Shows tree of database blocks;
- Export tree as SVG or PNG image;
- Shows every node in the block;
- Open any block just by clicking on node in parent block;
- Reload block info by clicking at the same node second time;
- Zoom in and out, fit and navigator;
- Easy way to switch between view modes (tree/map);
- Shows every block with the same colour for every globals;
- Legend for globals;
- In the IRIS image the map is read straight from the database file by
blocksmap(/rest/map). The server runs it in the background and the page shows a progress bar; databases with more than 60,000 blocks are drawn grouped (one cell stands for several blocks, hover shows the range), so a database of any size stays drawable. Images without the program (Caché) collect the map block by block through IRIS, as before;
You need license key for Caché or IRIS on RedHat systems.
docker run -d --name blocksexplorer --rm \
-p 57772:57772 \
-v /opt/some/database/for/test:/opt/blocks/db/test \
-v ~/cache.key:/usr/cachesys/mgr/cache.key \
daimor/blocksexplorer:cache
Generate blocks map as image file in out directory
docker run -it --rm \
-v /opt/some/database/for/test:/opt/blocks/db/test \
-v `pwd`/out:/opt/blocks/out \
daimor/blocksexplorer:cache generate
docker run -d --name blocksexplorer --rm \
-p 52773:52773 \
-v /opt/some/database/for/test:/opt/blocks/db/test \
daimor/blocksexplorer:iris
Generate blocks map as image file in out directory
docker run -it --rm \
-v /opt/some/database/for/test:/opt/blocks/db/test \
-v `pwd`/out:/opt/blocks/out \
daimor/blocksexplorer:iris generate
Run with docker-compose, will start web part with hot reloading.
docker-compose up -d --build
It will start server base on IRIS To start on Caché use this command
MODE=cache docker-compose up -d --build
By default running on 80 port. To start using it, just open http://localhost/
Using prebuild docker image gives a way to generate a picture for any IRIS or Caché database.
Use docker image daimor/blocksexplorer:iris for IRIS or daimor/blocksexplorer:cache for Caché Databases.
Those images accepts command generate with arguments
- path to the tested databases inside a container, by default
/db, can be omited - cellSize - size of the cell in pixels, where each cell represents particular database's block, by default 1
- cellSpace - sorrounding space between cell, by default 0
- showFill - sign to show how much block fill by data, by default 0
This tool generates a square picture in folder /out inside a container in formats BMP and PNG.
So, with command like this
docker run -v `pwd`/out:/out daimor/blocksexplorer:iris generate 20 1 1
It will generate this picture for an empty database.
With a lighter color visible that most of the blocks just empty.
The same test empty database, but with showFill=0
docker run -v `pwd`/out:/out daimor/blocksexplorer:iris generate 20 1 0
Blocks have different colors but just for globals, and does not show how much it fill.
More examples
ENSLIB
docker run -v `pwd`/out:/out daimor/blocksexplorer:iris generate /usr/irissys/mgr/enslib 5 1
IRISSYS
docker run -v `pwd`/out:/out daimor/blocksexplorer:iris generate /usr/irissys/mgr/ 5 1 1
For large databases, would not recommend to use have too big cellSize.
The map is drawn by blocksmap, a standalone program that reads the database file
(IRIS.DAT) directly. It needs neither a running instance, nor a license, nor ImageMagick, and is much
faster than walking the blocks through IRIS. The generate command above uses it in the IRIS image.
cd blocksmap && cargo build --release
./target/release/blocksmap /path/to/db/IRIS.DAT -o out --cell-size 5 --cell-space 1 --show-fill --bmp
| Option | Meaning |
|---|---|
<database> |
IRIS.DAT / CACHE.DAT, or the directory that contains it |
-o, --output |
folder for BlocksMap.png (default: current folder) |
--cell-size, --cell-space, --show-fill |
same as cellSize, cellSpace, showFill above |
--bmp, --no-png |
also write / skip the BMP |
--stats |
print a table per global and a space summary (see below); draws nothing unless -o or --bmp is also given |
--top N |
with --stats, list only the N largest globals |
--json FILE |
write the map as JSON for the web UI (- for stdout) instead of drawing |
--max-cells N |
with --json: at most N cells; larger databases are grouped, each cell standing for a run of blocks (the global with most blocks in it, fill averaged) |
--progress FILE |
keep this JSON file updated with the scan progress; deleting the file stops the scan |
--dump FILE |
write block|global|fill for every mapped block instead of drawing |
The picture is the same as before: BMP files are byte for byte identical to the ones Blocks.BlocksMap
produced, PNG files are pixel for pixel identical to the converted ones (red and blue are swapped
compared to what you might expect; that is how the old generator wrote the file and it is kept on purpose).
One row per global, largest first:
| Column | Meaning |
|---|---|
blocks, MiB |
blocks the global owns (data, pointer and big string blocks) and their size |
fill% |
average fill of its blocks that are not big strings |
frag% |
share of right links between data blocks that do not lead forward to a block at most 16 blocks away. 0% is a global stored in one sequential run, near 100% is scattered all over the file |
avg jump |
average distance of those links, in blocks |
reclaim MiB |
estimate of what compacting this global to 90% fill would free |
Below the table: blocks in globals / system / free, the space a truncate could return (free blocks at the end of the file), free blocks inside the file, the unused bytes inside blocks of globals, and a histogram of block fill. Fragmentation and reclaim are indicators, not measurements of what a real compaction would achieve.
Scanning takes well under a second for the system databases and about 20 seconds for a 10 GB database (1.3 million blocks) read cold from disk.
The block size (8, 16, 32 or 64 KB) is read from the database label. How the blocks are decoded is described in docs/DATABASE_FORMAT.md. Encrypted databases cannot be read.
There you can find more about database internals, and how to use this tool.




