All Projects → Spreads → Spreads.LMDB

Spreads / Spreads.LMDB

Licence: MPL-2.0 license
Low-level zero-overhead and the fastest LMDB .NET wrapper with some additional native methods useful for Spreads

Programming Languages

C#
18002 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Spreads.LMDB

Lmdb Embeddings
Fast word vectors with little memory usage in Python
Stars: ✭ 404 (+584.75%)
Mutual labels:  lmdb
Py Wsi
Python package for dealing with whole slide images (.svs) for machine learning, particularly for fast prototyping. Includes patch sampling and storing using OpenSlide. Patches may be stored in LMDB, HDF5 files, or to disk. It is highly recommended to fork and download this repository so that personal customisations can be made for your work.
Stars: ✭ 107 (+81.36%)
Mutual labels:  lmdb
Lmdbxx
C++11 wrapper for the LMDB embedded B+ tree database library.
Stars: ✭ 225 (+281.36%)
Mutual labels:  lmdb
Libmdbx
One of the fastest embeddable key-value ACID database without WAL. libmdbx surpasses the legendary LMDB in terms of reliability, features and performance.
Stars: ✭ 729 (+1135.59%)
Mutual labels:  lmdb
Crux
General purpose bitemporal database for SQL, Datalog & graph queries
Stars: ✭ 1,296 (+2096.61%)
Mutual labels:  lmdb
Lmdb Go
Bindings for the LMDB C library
Stars: ✭ 127 (+115.25%)
Mutual labels:  lmdb
Torch Toolbox
[Active development]ToolBox to make using Pytorch much easier.Give it a star if you feel helpful.
Stars: ✭ 268 (+354.24%)
Mutual labels:  lmdb
hermes
A library and microservice implementing the health and care terminology SNOMED CT with support for cross-maps, inference, fast full-text search, autocompletion, compositional grammar and the expression constraint language.
Stars: ✭ 131 (+122.03%)
Mutual labels:  lmdb
Ml Pyxis
Tool for reading and writing datasets of tensors in a Lightning Memory-Mapped Database (LMDB). Designed to manage machine learning datasets with fast reading speeds.
Stars: ✭ 93 (+57.63%)
Mutual labels:  lmdb
Rkv
A simple, humane, typed Rust interface to LMDB.
Stars: ✭ 178 (+201.69%)
Mutual labels:  lmdb
Nideep
collection of utilities to use with deep learning libraries (e.g. caffe)
Stars: ✭ 25 (-57.63%)
Mutual labels:  lmdb
Quadrable
Authenticated multi-version database: sparse binary merkle tree with compact partial-tree proofs
Stars: ✭ 78 (+32.2%)
Mutual labels:  lmdb
Ardb
A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
Stars: ✭ 1,707 (+2793.22%)
Mutual labels:  lmdb
Lmdbjava
Lightning Memory Database (LMDB) for Java: a low latency, transactional, sorted, embedded, key-value store
Stars: ✭ 546 (+825.42%)
Mutual labels:  lmdb
Cphalcon7
Dao7 - Web framework for PHP7.x,项目接洽 QQ 176013762
Stars: ✭ 237 (+301.69%)
Mutual labels:  lmdb
Datalevin
A simple, fast and durable Datalog database
Stars: ✭ 360 (+510.17%)
Mutual labels:  lmdb
Benchmarks
Benchmark of open source, embedded, memory-mapped, key-value stores available from Java (JMH)
Stars: ✭ 116 (+96.61%)
Mutual labels:  lmdb
FUTURE
A private, free, open-source search engine built on a P2P network
Stars: ✭ 19 (-67.8%)
Mutual labels:  lmdb
Sist2
Lightning-fast file system indexer and search tool
Stars: ✭ 245 (+315.25%)
Mutual labels:  lmdb
Heed
A fully typed LMDB/MDBX wrapper with minimum overhead
Stars: ✭ 142 (+140.68%)
Mutual labels:  lmdb
Linux Windows Mac
Build Status Build Status Build Status

Spreads.LMDB

Low-level zero-overhead and the fastest LMDB .NET wrapper with some additional native methods useful for Spreads.

Available on NuGet as Spreads.LMDB.

C# async/await support

LMDB's supported "normal" case is when a transaction is executed from a single thread. For .NET this means that if all operations on a transactions are called from a single thread it doesn't matter which thread is executing a transaction and LMDB will just work.

In some cases one my need background execution of write transactions or .NET async operations inside LMDB transactions. For this case Spreads.LMDB fully supports async/await. Write transactions are executed in a single thread via a blocking concurrent queue. Read transactions could be used from async code, which requires forcing MDB_NOTLS attribute for environments:

A thread may use parallel read-only transactions. A read-only transaction may span threads if the user synchronizes its use. Applications that multiplex many user threads over individual OS threads need this option. Such an application must also serialize the write transactions in an OS thread, since LMDB's write locking is unaware of the user threads.

Async support is disabled by default, but could be turned on via LMDBEnvironment.Create(..., disableAsync: false); if needed.

Read-only transaction and cursor renewal

Spreads.LMDB automatically takes care of read-only transaction and cursor renewals if they are properly disposed as .NET objects. It does not allocate those objects in steady state (uses internal pools).

Working with memory safely

Warning! This library exposes MDB_val directly as DirectBuffer struct, the struct MUST ONLY be read when inside a transaction (or when it points to an overflow page - but that is an undocumented hack working so far). For writes, the memory behind DirectBuffer MUST BE pinned.

DirectBuffer.Span property allows to access MDB_val as Span<byte>. DirectBuffer can be easily constructed from Span<byte>, but the span must be pinned as well if it is backed by byte[].

DirectBuffer has many methods to read/write primitive and generic blittable struct values from any offset, e.g. directBufferInstance.Read<ulong>(8) to read ulong from offset 8. By default it checks bounds, and an LMDB call via P/Invoke takes much longer so there is no reason to switch the bounds checks off. But you can still do so e.g. if you read separate bytes of large values a lot (e.g. via indexer directBufferInstance[offset] that returns a single byte at offset).

Generic key/values support

Any C# struct that has no references could be used directly as a key or a value. See IROCR docs. Be aware of auto layout, padding and related issues.

IEnumerable support

A database or duplicate values of a key in a single dupsorted database could be enumerated via dataBaseInstance.AsEnumerable([several overloads]) methods that could return either DirectBuffers or generic blittable structs.

Examples

Tests show how to use the code.

Status & limitations

This library is being deployed and tested in production and is went through many performance and correctness stress tests as a part of a larger workload.

The project has the required native binaries in its NuGet package. The library works with the original native LMDB binaries as well if not using two TryFind helper methods.

The library does not support nested transactions yet - only because we do not use them currently. They will be added as soon as we find a real-world compelling case for them.

Contributing

Issues & PRs are welcome!

Copyright

MPL 2.0 (c) Victor Baybekov, 2018-2021

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].