ustore

Multi-Modal Database replacing MongoDB, Neo4J, and Elastic with 1 faster ACID solution, with NetworkX and Pandas interfaces, and bindings for C 99, C++ 17, Python 3, Java, GoLang πŸ—„οΈ

https://github.com/unum-cloud/ustore

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • βœ“
    CITATION.cff file
    Found CITATION.cff file
  • βœ“
    codemeta.json file
    Found codemeta.json file
  • βœ“
    .zenodo.json file
    Found .zenodo.json file
  • β—‹
    DOI references
  • βœ“
    Academic publication links
    Links to: zenodo.org
  • β—‹
    Committers with academic emails
  • β—‹
    Institutional organization owner
  • β—‹
    JOSS paper metadata
  • β—‹
    Scientific vocabulary similarity
    Low similarity (7.1%) to scientific vocabulary

Keywords

acid apache-arrow arrow big-data bigdata database dataloader document-database graph-database iouring json key-value-store knn-search networkx nosql pandas python search spdk vector-search
Last synced: 4 months ago · JSON representation ·

Repository

Multi-Modal Database replacing MongoDB, Neo4J, and Elastic with 1 faster ACID solution, with NetworkX and Pandas interfaces, and bindings for C 99, C++ 17, Python 3, Java, GoLang πŸ—„οΈ

Basic Info
Statistics
  • Stars: 603
  • Watchers: 10
  • Forks: 34
  • Open Issues: 29
  • Releases: 46
Topics
acid apache-arrow arrow big-data bigdata database dataloader document-database graph-database iouring json key-value-store knn-search networkx nosql pandas python search spdk vector-search
Created over 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md

UStore

Modular 1 Multi-Modal 2 Transactional 3 Database
For Artificial Intelligence 4 and Semantic Search 5


Youtube     Discord     LinkedIn     Twitter     Blog     GitHub

1. supports: RocksDB LevelDB UDisk UCSet backends
2. can store: Blobs Documents Graphs Features Texts
3: guarantees Atomicity Consistency Isolation Durability
4: comes with Pandas and NetworkX API and PyTorch data-loaders
5: brings vector-search integrated with USearch and UForm

drivers: Python C C++ GoLang Java
packages: PyPI CMake Docker Hub Youtube intro Discord chat Full documentation          DOI         

Quickstart

Installing UStore is a breeze, and the usage is about as simple as a Python dict.

```python $ pip install ukv $ python

from ukv import umem

db = umem.DataBase() db.main[42] = 'Hi' ```

We have just create an in-memory embedded transactional database and added one entry in its main collection. Would you prefer that data on disk? Change one line.

```python from ukv import rocksdb

db = rocksdb.DataBase('/some-folder/') ```

Would you prefer to connect to a remote UStore server? UStore comes with an Apache Arrow Flight RPC interface!

```python from ukv import flight_client

db = flight_client.DataBase('grpc://0.0.0.0:38709') ```

Are you storing NetworkX-like MultiDiGraph? Or Pandas-like DataFrame?

```python db = rocksdb.DataBase()

userstable = db['users'].table userstable.merge(pd.DataFrame([ {'id': 1, 'name': 'Lex', 'lastname': 'Fridman'}, {'id': 2, 'name': 'Joe', 'lastname': 'Rogan'}, ]))

friendsgraph = db['friends'].graph friendsgraph.add_edge(1, 2)

assert friendsgraph.hasedge(1, 2) and \ friendsgraph.hasnode(1) and \ friendsgraph.numberof_edges(1, 2) == 1 ```

Function calls may look identical, but the underlying implementation can be addressing hundreds of terabytes of data placed somewhere in persistent memory on a remote machine.


Is someone else concurrently updating those collections? Bundle your operations to guarantee consistency!

python db = rocksdb.DataBase() with db.transact() as txn: txn['users'].table.merge(...) txn['friends'].graph.add_edge(1, 2)

So far we have only covered the tip of the UStore. You may use it to...

  1. Get C99, Python, GoLang, or Java wrappers for RocksDB or LevelDB.
  2. Serve them via Apache Arrow Flight RPC to Spark, Kafka, or PyTorch.
  3. Store Document and Graphs in embedded DB, avoiding networking overheads.
  4. Tier DBMS between in-memory and persistent backends under one API.

But UStore can more. Here is the map:


Basic Usage

UStore is intended not just as database, but as "build your database" toolkit and an open standard for NoSQL potentially-transactional databases, defining zero-copy binary interfaces for "Create, Read, Update, Delete" operations, or CRUD for short.

A few simple C99 headers can link almost any underlying storage engine to numerous high-level language drivers, extending their support for binary string values to graphs, flexible-schema documents, and other modalities, aiming to replace MongoDB, Neo4J, Pinecone, and ElasticSearch with a single ACID-transactional system.

UStore: Small Map

Redis, for example, provides RediSearch, RedisJSON, and RedisGraph with similar objectives. UStore does it better, allowing you to add your favorite Key-Value Stores (KVS), embedded, standalone, or sharded, such as FoundationDB, multiplying its functionality.

Modalities

Blobs

Binary Large Objects can be placed inside UStore. The performance will vastly vary depending on the used underlying technology. The in-memory UCSet will be the fastest, but the least suited for larger objects. The persistent UDisk, when properly configured, can entirely bypass the the Linux kernel, including the filesystem layer, directly addressing block devices.

Binary Processing Performance Chart for UDisk and RocksDB

Modern persistent IO on high-end servers can exceed 100 GB/s per socket when built on user-space drivers like SPDK. This is close to the real-world throughput of high-end RAM and unlocks new, uncommon to databases use cases. One may now put a Gigabyte-sized video file in an ACID-transactional database, right next to its metadata, instead of using a separate object store, like MinIO.

Documents

JSON is the most commonly used document format these days. UStore document collections support JSON, as well as MessagePack, and BSON, used by MongoDB.

Documents Processing Performance Chart for UStore and MongoDB

UStore doesn't scale horizontally yet, but provides much higher single-node performance, and has almost linear vertical scalability on many-core systems thanks to the open-source simdjson and yyjson libraries. Moreover, to interact with data, you don't need a custom query language like MQL. Instead we prioritize open RFC standards to truly avoid vendor locks:

Graphs

Modern Graph databases, like Neo4J, struggle with large workloads. They require too much RAM, and their algorithms observe data one entry at a time. We optimize on both fronts:

  • Using delta-coding to compress inverted indexes.
  • Updating classical graph algorithms for high-latency storage to process graphs in Batch-like or Edge-centric fashion.

Vectors

Feature Stores and Vector Databases, like Pinecone, Milvus, and USearch provide standalone indexes for vector search. UStore implements it as a separate modality, on par with Documents and Graphs. Features:

  • 8-bit integer quantization.
  • 16-bit floating-point quantization.
  • Cosine, Inner Product, and Euclidean metrics.

Drivers

UStore for Python and for C++ look very different. Our Python SDK mimics other Python libraries - Pandas and NetworkX. Similarly, C++ library provides the interface C++ developers expect.

UStore: Frontends

As we know, people use different languages for different purposes. Some C-level functionality isn't implemented for some languages. Either because there was no demand for it, or as we haven't gotten to it yet.

| Name | Transact | Collections | Batches | Docs | Graphs | Copies | | :-------------------------- | :------: | :---------: | :-----: | :---: | :----: | :----: | | C99 Standard | | | | | | 0 | | | | | | | | | | C++ SDK | | | | | | 0 | | Python SDK | | | | | | 0-1 | | GoLang SDK | | | | | | 1 | | Java SDK | | | | | | 1 | | | | | | | | | | Arrow Flight API | | | | | | 0-2 |

Some frontends here have entire ecosystems around them! Apache Arrow Flight API, for instance, has its own drivers for C, C++, C#, Go, Java, JavaScript, Julia, MATLAB, Python, R, Ruby and Rust.

UStore: Frontends

Frequently Questioned Answers

  • Keys are 64-bit integers, by default. Why?
  • Values are binary strings under 4 GB long. Why?

Frequently Asked Questions

Advanced Usage

Engines

Following engines can be used almost interchangeably. Historically, LevelDB was the first one. RocksDB then improved on functionality and performance. Now it serves as the foundation for half of the DBMS startups.

| | LevelDB | RocksDB | UDisk | UCSet | | :----------------------- | :-----: | :------: | :-----: | :-----: | | Speed | 1x | 2x | 10x | 30x | | Persistent | | | | | | Transactional | | | | | | Block Device Support | | | | | | Encryption | | | | | | Watches | | | | | | Snapshots | | | | | | Random Sampling | | | | | | Bulk Enumeration | | | | | | Named Collections | | | | | | Open-Source | | | | | | Compatibility | Any | Any | Linux | Any | | Maintainer | Google | Facebook | Unum | Unum |

UCSet and UDisk are both designed and maintained by Unum. Both are feature-complete, but the most crucial feature our alternatives provide is performance. Being fast in memory is easy. The core logic of UCSet can be found in the templated header-only ucset library.

Designing UDisk was a much more challenging 7-year long endeavour. It included inventing new tree-like structures, implementing partial kernel bypass with io_uring, complete bypass with SPDK, CUDA GPU acceleration, and even a custom internal filesystem. UDisk is the first engine to be designed from scratch with parallel architectures and kernel-bypass in mind.

Transactions

Atomicity

Atomicity is always guaranteed. Even on non-transactional writes - either all updates pass or all fail.

Consistency

Consistency is implemented in the strictest possible form - "Strict Serializability" meaning that:

The default behavior, however, can be tweaked at the level of specific operations. For that the ::ustore_option_transaction_dont_watch_k can be passed to ustore_transaction_init() or any transactional read/write operation, to control the consistency checks during staging.

| | Reads | Writes | | :----------------------------------- | :-----------: | :-----------: | | Head | Strict Serial | Strict Serial | | Transactions over Snapshots | Serial | Strict Serial | | Transactions w/out Snapshots | Strict Serial | Strict Serial | | Transactions w/out Watches | Strict Serial | Sequential |

If this topic is new to you, please check out the Jepsen.io blog on consistency.

Isolation

| | Reads | Writes | | :----------------------------------- | :---: | :----: | | Transactions over Snapshots | | | | Transactions w/out Snapshots | | |

Durability

Durability doesn't apply to in-memory systems by definition. In hybrid or persistent systems we prefer to disable it by default. Almost every DBMS that builds on top of KVS prefers to implement its own durability mechanism. Even more so in distributed databases, where three separate Write Ahead Logs may exist:

  • in KVS,
  • in DBMS,
  • in Distributed Consensus implementation.

If you still need durability, flush writes on commits with an optional flag. In the C driver you would call ustore_transaction_commit() with the ::ustore_option_write_flush_k flag.

Containers and Cloud Deployments

The entire DBMS fits into a sub 100 MB Docker image. Run the following script to pull and run the container, exposing Apache Arrow Flight server on the port 38709. Client SDKs will also communicate through that same port, by default.

sh docker run -d --rm --name ustore-test -p 38709:38709 unum/ustore

The default configuration file can be retrieved with:

sh cat /var/lib/ustore/config.json

The simplest way to connect and test would be the following command:

sh python ...

Pre-packaged UStore images are available on multiple platforms:

  • Docker Hub image: v0.7.
  • RedHat OpenShift operator: v0.7.
  • Amazon AWS Marketplace images:
    • Free Community Edition: v0.4.
    • In-Memory Edition:
    • Performance Edition:

Don't hesitate to commercialize and redistribute UStore.

Configuration

Tuning databases is as much art as it is science. Projects like RocksDB provide dozens of knobs to optimize the behavior. We allow forwarding specialized configuration files to the underlying engine.

json { "version": "1.0", "directory": "./tmp/" }

We also have a simpler procedure, which would be enough for 80% of users. That can be extended to utilize multiple devices or directories, or to forward a specialized engine config.

json { "version": "1.0", "directory": "/var/lib/ustore", "data_directories": [ { "path": "/dev/nvme0p0/", "max_size": "100GB" }, { "path": "/dev/nvme1p0/", "max_size": "100GB" } ], "engine": { "config_file_path": "./engine_rocksdb.ini", } }

Database collections can also be configured with JSON files.

Key Sizes

As of the current version, 64-bit signed integers are used. It allows unique keys in the range from [0, 2^63). 128-bit builds with UUIDs are coming, but variable-length keys are highly discouraged. Why so?

Using variable length keys forces numerous limitations on the design of a Key-Value store. Firstly, it implies slow character-wise comparisons a performance killer on modern hyperscalar CPUs. Secondly, it forces keys and values to be joined on a disk to minimize the needed metadata for navigation. Lastly, it violates our simple logical view of KVS as a "persistent memory allocator", putting a lot more responsibility on it.


The recommended approach to dealing with string keys is:

  1. Choose a mechanism to generate unique integer keys (UID). Ex: monotonically increasing values.
  2. Use "paths" modality build up a persistent hash map of strings to UIDs.
  3. Use those UIDs to address the rest of the data in binary, document and graph modalities.

This will result in a single conversion point from string to integer representations and will keep most of the system snappy and the C-level interfaces simpler than they could have been.

Value Sizes

We can only address 4 GB values or smaller as of the current now. Why? Key-Value Stores are generally intended for high-frequency operations. Frequently (thousands of times each second), accessing and modifying 4 GB and larger files is impossible on modern hardware. So we stick to smaller length types, making using Apache Arrow representation slightly easier and allowing the KVS to compress indexes better.

Roadmap

Our development roadmap is public and is hosted within the GitHub repository. Upcoming tasks include:

  • [x] Builds for Arm, MacOS.
  • [x] Persistent Snapshots.
  • [ ] Continuous Replication.
  • [ ] Document-schema validation.
  • [ ] Richer drivers for GoLang, Java, JavaScript.
  • [ ] Improved Vector Search.
  • [ ] Collection-level configuration.
  • [ ] Owning and non-owning C++ wrappers.
  • [ ] Horizontal Scaling.

Read full roadmap in our docs here.

Owner

  • Name: Unum
  • Login: unum-cloud
  • Kind: organization
  • Email: info@unum.cloud
  • Location: Armenia

Scaling Intelligence

Citation (CITATION.cff)

cff-version: 0.13.12
message: "If you use this software, please cite it as below."
authors:
- family-names: "Vardanian"
  given-names: "Ash"
  orcid: "https://orcid.org/0000-0002-4882-1815"
title: "UStore by Unum Cloud"
version: 0.13.12
doi: 10.5281/zenodo.7537043
date-released: 2022-06-12
url: "https://github.com/unum-cloud/ustore"

GitHub Events

Total
  • Watch event: 70
  • Issue comment event: 2
  • Fork event: 5
Last Year
  • Watch event: 70
  • Issue comment event: 2
  • Fork event: 5

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 3,023
  • Total Committers: 18
  • Avg Commits per committer: 167.944
  • Development Distribution Score (DDS): 0.633
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ashot Vardanian 1****n 1,110
Davit Vardanyan 7****d 659
Ishkhan Nazaryan 1****2 295
Violeta Stepanyan 8****n 281
Gurgen Yegoryan 2****n 266
Darvin Harutyunyan 1****n 187
Arman Ghazaryan 9****n 133
semantic-release-bot s****t@m****t 43
Mesrop 7****r 22
Mesrop Gevorgyan 7****u 9
Craig Spence c****0@g****m 5
violeta v****a@l****t 5
menuet m****t 2
Aleksandr Kent 4****t 2
Arsenic 5****G 1
Vladimir Orshulevich 3****R 1
Haris Botić h****1@g****m 1
Jakob Voß j****b@n****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 67
  • Total pull requests: 113
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 6 days
  • Total issue authors: 13
  • Total pull request authors: 13
  • Average comments per issue: 1.87
  • Average comments per pull request: 0.81
  • Merged pull requests: 97
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • DarvinHarutyunyan (20)
  • davvard (15)
  • ashvardanian (11)
  • AleksandrKent (7)
  • VioletaStepanyan (3)
  • Arman-Ghazaryan (1)
  • itroyano (1)
  • chungquantin (1)
  • gurgenyegoryan (1)
  • espdev (1)
  • Amrosx (1)
  • criver (1)
Pull Request Authors
  • DarvinHarutyunyan (30)
  • davvard (24)
  • VioletaStepanyan (13)
  • ashvardanian (10)
  • gurgenyegoryan (7)
  • mgevor (5)
  • phenomnomnominal (5)
  • AleksandrKent (1)
  • harisbotic (1)
  • ishkhan42 (1)
  • michaelgrigoryan25 (1)
  • Arman-Ghazaryan (1)
  • menuet (1)
Top Labels
Issue Labels
bug (31) invalid (31) enhancement (27) released on @alpha (3) semantic-release (3) good first issue (3)
Pull Request Labels
released on @alpha (44) released on @latest (6) bug (2) enhancement (2)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 348 last-month
  • Total docker downloads: 47
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 101
  • Total maintainers: 1
proxy.golang.org: github.com/unum-cloud/ustore
  • Versions: 57
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.0%
Average: 9.6%
Dependent repos count: 10.2%
Last synced: 5 months ago
pypi.org: ukv

Python bindings for Unum's UStore.

  • Versions: 23
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 295 Last month
  • Docker Downloads: 47
Rankings
Stargazers count: 3.9%
Dependent packages count: 6.6%
Forks count: 9.7%
Downloads: 12.5%
Average: 12.7%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 5 months ago
pypi.org: ustore

Python bindings for Unum's UStore.

  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 53 Last month
Rankings
Stargazers count: 3.2%
Forks count: 7.3%
Dependent packages count: 10.1%
Average: 17.8%
Dependent repos count: 21.6%
Downloads: 46.9%
Maintainers (1)
Last synced: 5 months ago

Dependencies

.github/workflows/prerelease.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3.0.1 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3.1.1 composite
  • docker/setup-buildx-action v2 composite
  • docker/setup-qemu-action v2 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/configure-pages v2 composite
  • actions/deploy-pages v1 composite
  • actions/download-artifact v3.0.2 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
  • actions/upload-pages-artifact v1 composite
  • docker/build-push-action v4 composite
  • docker/login-action v2 composite
  • docker/setup-buildx-action v2 composite
  • docker/setup-qemu-action v2 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • xresloader/upload-to-github-release v1 composite
.devcontainer/Dockerfile docker
  • mcr.microsoft.com/vscode/devcontainers/cpp 0-${VARIANT} build
Dockerfile docker
  • ubuntu 22.04 build
docker/Dockerfile docker
  • ubuntu focal build
build.gradle maven
  • junit:junit 4.13.2 testImplementation
pom.xml maven
.github/workflows/package.json npm
  • @semantic-release/exec github:semantic-release/exec development
  • @semantic-release/git ^10.0.1 development
  • conventional-changelog-eslint ^3.0.9 development
  • semantic-release ^20.1.3 development
pyproject.toml pypi
setup.py pypi
  • numpy >=1.16