wiki:NifDB

Version 1 (modified by manualwiki, 13 years ago) (diff)

NifDB created

Using the NIF database back-end

Currently, the Mnesia based back-end is the default, therefore you have to specify a command line argument if you would like to use the NIF based back-end.

After the system is installed, start RefactorErl with

bin/referl -db nif

NIF uses the RefactorErl data directory to store its data. You can specify it by typing

bin/referl -db nif -dir /path/to/your/data/dir

If you would like to start several instances of RefactorErl/NIF, you have to choose different node names. It is also suggested to set different data directories as well, although it is not strictly required.

bin/referl -db nif -sname name1 -dir /path/to/your/data/dir1
bin/referl -db nif -sname name2 -dir /path/to/your/data/dir2

# or

bin/referl -db nif -name name1 -dir /path/to/your/data/dir1
bin/referl -db nif -name name2 -dir /path/to/your/data/dir2

After the system is started, the following operations work on the full database.

% Clear the whole database.
ri:reset().

% Make a checkpoint.
% This operation is always executed after transformations
% and file operations (e.g. adding or dropping a file).
ri:backup().

% Make a checkpoint with a commit log message.
ri:backup(CommitLogMsg).

% Lists all backups.
ri:ls_backups().

% Undo all changes made since the last backup.
ri:undo().

% Removes all backups.
ri:clean().

You can also use all querying and refactoring functionalities.

Comparison with the Mnesia back-end

While the Mnesia back-end has been under development longer and can be expected to be more stable, it is much slower than the NIF based back-end; you can expect about an order of magnitude of speed-up. Also, the NIF back-end may require less storage. As an indication, loading ejabberd-2.1.8 (6.6 MB on disk) takes 18323 sec and 566 MB of RAM and 66 MB of disk space, while the NIF back-end on the same machine takes 458 sec and 556 MB of RAM and 52 MB of disk space.