|
xrpld
|

Directories | |
| detail | |
Files | |
| Backend.h | |
| Database.h | |
| DatabaseRotating.h | |
| DummyScheduler.h | |
| Factory.h | |
| Manager.h | |
| NodeObject.h | |
| Scheduler.h | |
| Task.h | |
| Types.h | |
A NodeObject is a simple object that the Ledger uses to store entries. It is comprised of a type, a hash and a blob. It can be uniquely identified by the hash, which is a 256 bit hash of the blob. The blob is a variable length block of serialized data. The type identifies what the blob contains. The fields are as follows:
An enumeration that determines what the blob holds. There are four different types of objects stored.
ledger
A ledger header.
transaction
A signed transaction.
account node
A node in a ledger's account state tree.
transaction node
A node in a ledger's transaction tree.
A 256-bit hash of the blob.
A blob containing the payload. Stored in the following format.
| Byte | ||
|---|---|---|
| 0...7 | unused | |
| 8 | type | NodeObjectType enumeration |
| 9...end | data | body of the object data |
The NodeStore provides an interface that stores, in a persistent database, a collection of NodeObjects that xrpld uses as its primary representation of ledger entries. All ledger entries are stored as NodeObjects and as such, need to be persisted between launches. If a NodeObject is accessed and is not in memory, it will be retrieved from the database.
The NodeStore implementation provides the Backend abstract interface, which lets different key/value databases to be chosen at run-time. This allows experimentation with different engines. Improvements in the performance of the NodeStore are a constant area of research. The database can be specified in the configuration file [node_db] section as follows.
One or more lines of key / value pairs
Example:
Choices for 'type' (not case-sensitive)
An improved version of LevelDB (preferred).
Google's LevelDB database (deprecated).
Use no backend.
Facebook's RocksDB database, builds on LevelDB.
Use SQLite.
'path' specifies where the backend will store its data files.
Choices for 'compression'
The NodeStore.Timing test is used to execute a set of read/write workloads to compare current available nodestore backends. It can be executed with:
It is also possible to use alternate DB config params by passing config strings as --unittest-arg.
The discussion below refers to a RocksDBQuick backend that has since been removed from the code as it was not working and not maintained. That backend primarily used one of the several rocks Optimize* methods to setup the majority of the DB options/params, whereas the primary RocksDB backend exposes many of the available config options directly. The code for RocksDBQuick can be found in versions of this repo 1.2 and earlier if you need to refer back to it. The conclusions below date from about 2014 and may need revisiting based on newer versions of RocksDB (TBD).
RocksDBQuickFactory is intended to provide a testbed for comparing potential rocksdb performance with the existing recommended configuration in xrpld.cfg. Through various executions and profiling some conclusions are presented below.