cosmos72 / hyperluminal-db

(ALPHA) Persistent, memory-mapped Common Lisp object store
GNU General Public License v3.0
13 stars 3 forks source link

Hyperluminal-DB

Summary

Hyperluminal-DB is a high-performance, memory-mapped object database for Common Lisp.

It is based on Hyperluminal-MEM, a serialization/deserialization library, and STMX, a high-performance implementation of transactional memory.

Features

Hyperluminal-DB is designed and optimized for the following scenarios:

Latest news, 24th January 2015

Released version 0.5.1.

This is the last release packaging together Hyperluminal-MEM and Hyperluminal-DB in a single GPLv3 library.

News, 9th February 2014

Released version 0.5.0.

The serialization library is tested, documented and ready to use. It may still contain some rough edges and small bugs.

News, 1st February 2014

The serialization library works and is in BETA status.

The memory-mapped database (built on top of the serialization library) is in the early-implementation stage, not yet ready for general use.

Supported systems

Hyperluminal-DB is currently tested on the following Common Lisp implementations:

Unsupported systems

Other systems

Hyperluminal-DB requires several libraries to work: LOG4CL, CLOSER-MOP, TRIVIAL-GARBAGE, BORDEAUX-THREADS, CFFI, OSICAT, STMX and HYPERLUMINAL-MEM. The last five, while reasonably portable, exploit features well beyond ANSI Common Lisp and their support for the various Common Lisp implementations varies widely.

For this reason no general guarantees can be given: Hyperluminal-DB may or may not work on other, untested Common Lisp implementations.

Installation and loading

Hyperluminal-DB is available from GitHub. The simplest way to obtain it is to first install Quicklisp then download Hyperluminal-MEM and Hyperluminal-DB into your Quicklisp local-projects folder. Open a shell and run the commands:

$ cd ~/quicklisp/local-projects
$ git clone git://github.com/cosmos72/hyperluminal-mem.git
$ git clone git://github.com/cosmos72/hyperluminal-db.git

then open a REPL and run:

CL-USER> (ql:quickload "hyperluminal-db")
;; lots of output...
CL-USER> (use-package :hlmem)
CL-USER> (use-package :hldb)

If all goes well, this will load Hyperluminal-DB and its dependencies:

Troubleshooting

In case you get errors:

Testing that it works

After loading Hyperluminal-DB for the first time, it is recommended to run STMX, Hyperluminal-MEM and Hyperluminal-DB test suites to check that everything works as expected. From the REPL, run:

CL-USER> (asdf:test-system :stmx)
;; lots of output...
 Did 7133 checks.
    Pass: 7133 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

CL-USER> (asdf:test-system :hyperluminal-mem)
;; lots of output...
 Did 4092 checks.
    Pass: 4092 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

CL-USER> (asdf:test-system :hyperluminal-db)
;; lots of output...
 Did 2505 checks.
    Pass: 2505 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

Note: all the (asdf:test-system ...) intentionally work only after the corresponding library has been loaded successfully with (ql:quickload ...).

All the test suites should report zero Skip and zero Fail; the number of Pass may vary. You are welcome to report any failure you get while running the test suites, please include in the report:

See "Contacts, help, discussion" below for the preferred method to send the report.

Implementation

Hyperluminal-DB is loosely inspired by some techniques used by manardb but it is a completely separate and independent project.

It is based on STMX, a high-performance hybrid transactional memory library, and Hyperluminal-MEM, a high-performance serialization library, both from the same author.

Hyperluminal-DB uses a (supposedly) clever trick in order to overcome Intel claims that hardware memory transactions (specifically, Intel TSX) cannot perform input/output.

The result is that Hyperluminal-DB is able to perform transactional input/output while running hardware memory transactions - an apparent paradox - in an extremely specific but significant case: reading and writing memory-mapped files.

This allows reaching extremely high transaction speeds: the only hard limit is the hardware - an Intel Core i7 4770 peaks at 400 millions transactions per second when all the 4 cores and hyperthreading are exploited.

Quite clearly, the speed also strongly depends on the amount (and type) of data read and written during each transaction.

Basic usage

TODO

File format and ABI

Hyperluminal-DB file format and ABI is inherited from Hyperluminal-MEM, which performs autodetection to match Lisp idea of CFFI-SYS pointers:

It is possible to override such autodetection by adding an appropriate entry in the global variable *FEATURES* before compiling and loading Hyperluminal-MEM, see Hyperluminal-MEM/README for details.


As of February 2015, Hyperluminal-DB is being written by Massimiliano Ghilardi and it is considered by the author to be in ALPHA status.

Contacts, help, discussion

As long as the traffic is low enough, GitHub Issues can be used to report test suite failures, bugs, suggestions, general discussion etc.

If the traffic becomes high, more appropriate discussion channels will be set-up.

The author will also try to answer support requests, but gives no guarantees.

Legal

Hyperluminal-DB is released under the terms of the GNU General Public License v3.0, known as the GPLv3.