{"id":29482666,"url":"https://github.com/voidDB/voidDB","last_synced_at":"2025-07-15T02:02:12.084Z","repository":{"id":259930182,"uuid":"879826699","full_name":"voidDB/voidDB","owner":"voidDB","description":"A transactional key-value database written in Go for Linux and macOS","archived":false,"fork":false,"pushed_at":"2025-07-01T03:10:12.000Z","size":179,"stargazers_count":195,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-01T03:37:53.353Z","etag":null,"topics":["acid","database","fast","go","golang","in-memory","key-value","lightweight","linux","macos","mmap","mvcc","nosql","replication","storage","zero-copy"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/voidDB/voidDB","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voidDB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-28T16:02:36.000Z","updated_at":"2025-07-01T03:10:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"902d6a1d-ea49-4bbd-8a39-c9adf498ed0a","html_url":"https://github.com/voidDB/voidDB","commit_stats":null,"previous_names":["voiddb/voiddb"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/voidDB/voidDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidDB%2FvoidDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidDB%2FvoidDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidDB%2FvoidDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidDB%2FvoidDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voidDB","download_url":"https://codeload.github.com/voidDB/voidDB/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidDB%2FvoidDB/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265386079,"owners_count":23756747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acid","database","fast","go","golang","in-memory","key-value","lightweight","linux","macos","mmap","mvcc","nosql","replication","storage","zero-copy"],"created_at":"2025-07-15T02:01:21.304Z","updated_at":"2025-07-15T02:02:12.069Z","avatar_url":"https://github.com/voidDB.png","language":"Go","readme":"# voidDB\n\n\u003ca href=\"https://pkg.go.dev/github.com/voidDB/voidDB\"\u003e\n  \u003cimg src=\"https://pkg.go.dev/badge/github.com/voidDB/voidDB.svg\" /\u003e\n\u003c/a\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/voidDB.png\" width=\"230\" /\u003e\n\u003c/div\u003e\n\nvoidDB is a [memory-mapped](https://man7.org/linux/man-pages/man2/mmap.2.html)\nkey-value store: simultaneously in-memory and persistent on disk. An embedded\ndatabase manager, it is meant to be integrated into application software to\neliminate protocol overheads and achieve zero-copy performance. This library\nsupplies interfaces for storage and retrieval of arbitrary bytes on 64-bit\ncomputers running Linux and macOS.\n\nvoidDB features Put, Get, and Del operations as well as forward and backward\niteration over self-sorting data in ACID (atomic, consistent, isolated, and\ndurable) transactions. Readers retain a consistent view of the data throughout\ntheir lifetime, even as newer transactions are being committed: only pages\nfreed by transactions older than the oldest surviving reader are actively\nrecycled.\n\nvoidDB employs a copy-on-write strategy to maintain data in a multi-version\nconcurrency-controlled (MVCC) B+ tree structure. It allows virtually any number\nof concurrent readers, but only one active writer at any given moment. Readers\n(and the sole writer) neither compete nor block one another, even though they\nmay originate from and operate within different threads and processes.\n\nvoidDB is resilient against torn writes. It automatically restores a database\nto its last stable state in the event of a mid-write crash. Once a transaction\nis committed and flushed to disk it is safe, but even if not it could do no\nharm to existing data in storage. Applications need not be concerned about\nbroken lockfiles or lingering effects of unfinished transactions should an\nuncontrolled shutdown occur; its design guarantees automatic and immediate\nrelease of resources upon process termination.\n\n## Benchmarks\n\nvoidDB outperforms well-known key-value stores available to Go developers that\nare based on B+ trees (LMDB, bbolt) and log-structured merge(LSM)-trees\n(LevelDB, BadgerDB), in [preliminary performance tests](test/bench_test.go)\nconducted on x86-64 and AArch64 instances hosted on Google Cloud (N2, T2A/D\nmachine series, 8 vCPUs, 32 GB memory).\n\n### Put\n\n#### 4,096 × 256-KiB random values\n\n```txt\n|                   (ms/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      1.16 |         1.12 |               1.16 |\n| voidDB (named keyspace)   |      1.16 |         1.12 |               1.16 |\n| LMDB (default keyspace)   |      1.90 |         2.00 |               1.93 |\n| Bolt                      |      1.96 |         1.76 |               2.45 |\n| LMDB (named keyspace)     |      2.11 |         2.26 |               2.15 |\n| LevelDB                   |      2.37 |         2.23 |               2.75 |\n| BadgerDB                  |      3.22 |         5.31 |               3.14 |\n```\n\n#### 65,536 × 16-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (named keyspace)   |      82.7 |         82.8 |               85.0 |\n| voidDB (default keyspace) |      83.5 |         77.7 |               85.3 |\n| LMDB (named keyspace)     |     152   |        154   |              151   |\n| LMDB (default keyspace)   |     157   |        156   |              157   |\n| BadgerDB                  |     195   |        225   |              183   |\n| Bolt                      |     244   |        217   |              429   |\n| LevelDB                   |     362   |        310   |              303   |\n```\n\n#### 1,048,576 × 1-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      18.7 |         19.5 |               21.4 |\n| voidDB (named keyspace)   |      18.4 |         19.8 |               21.9 |\n| BadgerDB                  |      24.2 |         23.9 |               25.8 |\n| LMDB (named keyspace)     |      28.2 |         32.3 |               33.5 |\n| LMDB (default keyspace)   |      29.5 |         34.4 |               36.6 |\n| LevelDB                   |      72.5 |         58.8 |              165   |\n| Bolt                      | timed out | timed out    | timed out          |\n```\n\n### Get\n\n#### 4,096 × 256-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (named keyspace)   |      1.64 |         1.76 |               1.66 |\n| voidDB (default keyspace) |      1.65 |         1.74 |               1.78 |\n| LMDB (named keyspace)     |      4.97 |         3.97 |               4.46 |\n| LMDB (default keyspace)   |      5.00 |         4.03 |               4.33 |\n| Bolt                      |      5.88 |         5.17 |               5.76 |\n| LevelDB                   |    115    |       125    |             224    |\n| BadgerDB                  |    301    |       142    |             618    |\n```\n\n#### 65,536 × 16-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      1.73 |         2.01 |               2.29 |\n| voidDB (named keyspace)   |      1.76 |         2.02 |               2.11 |\n| LMDB (named keyspace)     |      2.47 |         2.73 |               3.05 |\n| LMDB (default keyspace)   |      2.62 |         2.60 |               3.12 |\n| Bolt                      |      3.68 |         3.87 |               4.59 |\n| LevelDB                   |     27.4  |        34.6  |              46.1  |\n| BadgerDB                  |     21.1  |        41.8  |              71.2  |\n```\n\n#### 1,048,576 × 1-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      1.76 |         2.15 |               2.54 |\n| voidDB (named keyspace)   |      2.07 |         2.58 |               3.00 |\n| LMDB (named keyspace)     |      2.09 |         2.68 |               2.97 |\n| LMDB (default keyspace)   |      2.22 |         2.68 |               3.02 |\n| BadgerDB                  |     23.8  |        22.8  |              31.1  |\n| LevelDB                   |     27.3  |        45.7  |              40.7  |\n| Bolt                      | timed out | timed out    | timed out          |\n```\n\n### GetNext\n\n#### 4,096 × 256-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      1.17 |         .938 |               1.15 |\n| voidDB (named keyspace)   |      1.27 |         .939 |               1.12 |\n| Bolt                      |      2.13 |        1.55  |               1.83 |\n| LMDB (named keyspace)     |      4.54 |        3.50  |               3.80 |\n| LMDB (default keyspace)   |      4.65 |        3.44  |               3.90 |\n| LevelDB                   |    107    |      110     |             181    |\n| BadgerDB                  |    198    |       58.7   |             415    |\n```\n\n#### 65,536 × 16-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      .808 |         .721 |               .891 |\n| voidDB (named keyspace)   |      .849 |         .730 |               .874 |\n| Bolt                      |     1.18  |         .869 |               .919 |\n| LMDB (default keyspace)   |     1.78  |        1.47  |              1.64  |\n| LMDB (named keyspace)     |     1.78  |        1.44  |              1.68  |\n| LevelDB                   |    14.7   |       14.7   |             22.3   |\n| BadgerDB                  |    26.1   |        6.54  |             24.1   |\n```\n\n#### 1,048,576 × 1-KiB random values\n\n```txt\n|                   (μs/op) | AMD Milan | Ampere Altra | Intel Cascade Lake |\n| ------------------------- | --------- | ------------ | ------------------ |\n| voidDB (default keyspace) |      .307 |         .270 |               .384 |\n| voidDB (named keyspace)   |      .296 |         .515 |               .402 |\n| LMDB (named keyspace)     |      .615 |         .515 |               .637 |\n| LMDB (default keyspace)   |      .607 |         .519 |               .642 |\n| LevelDB                   |     1.38  |        1.80  |              1.92  |\n| BadgerDB                  |     4.03  |        5.60  |             15.0   |\n| Bolt                      | timed out | timed out    | timed out          |\n```\n\n## Getting Started\n\n[Install Go](https://go.dev/doc/install) to begin developing with voidDB.\n\n```bash\n$ go version\ngo version go1.24.0 linux/arm64\n```\n\nThen, import voidDB in your Go application. The following would result in the\ncreation of a database file and its reader table in the working directory. Set\nthe database capacity to any reasonably large value to make sufficient room for\nthe data you intend to store, even if it exceeds the total amount of physical\nmemory; neither memory nor disk is immediately consumed to capacity.\n\n```go\npackage main\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/voidDB/voidDB\"\n)\n\nfunc main() {\n\tconst (\n\t\tcapacity = 1 \u003c\u003c 40 // 1 TiB\n\t\tpath     = \"void\"\n\t)\n\n\tvoid, err := voidDB.NewVoid(path, capacity)\n\n\tif errors.Is(err, os.ErrExist) {\n\t\tvoid, err = voidDB.OpenVoid(path, capacity)\n\t}\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer void.Close()\n}\n```\n\nUse `*Void.View` (or `*Void.Update` only when modifying data) for convenience\nand peace of mind. Ensure all changes are safely synced to disk with `mustSync`\nset to `true` if even the slightest risk of losing those changes is a concern.\n\n```go\nmustSync := true\n\nerr = void.Update(mustSync,\n\tfunc(txn *voidDB.Txn) error {\n\t\treturn txn.Put(\n\t\t\t[]byte(\"greeting\"),\n\t\t\t[]byte(\"Hello, World!\"),\n\t\t)\n\t},\n)\nif err != nil {\n\tpanic(err)\n}\n```\n\nOpen a cursor if more than one keyspace is required. An application can map\ndifferent values to the same key so long as they reside in separate keyspaces.\nThe transaction handle doubles as a cursor in the default keyspace.\n\n```go\ncur0, _ := txn.OpenCursor([]byte(\"hello\"))\n\ncur0.Put([]byte(\"greeting\"),\n\t[]byte(\"Hello, World!\"),\n)\n\ncur1, _ := txn.OpenCursor([]byte(\"goodbye\"))\n\ncur1.Put([]byte(\"greeting\"),\n\t[]byte(\"さらばこの世、わらわはもう寝るぞよ。\"),\n)\n\nif val, err := cur0.Get([]byte(\"greeting\")); err == nil {\n\tlog.Printf(\"%s\", val) // Hello, World!\n}\n\nif val, err := cur1.Get([]byte(\"greeting\")); err == nil {\n\tlog.Printf(\"%s\", val) // さらばこの世、わらわはもう寝るぞよ。\n}\n```\n\nTo iterate over a keyspace, use `*cursor.Cursor.GetNext`/`GetPrev`. Position\nthe cursor with `*cursor.Cursor.Get`/`GetFirst`/`GetLast`.\n\n```go\nfor {\n\tkey, val, err := cur.GetNext()\n\n\tif errors.Is(err, common.ErrorNotFound) {\n\t\tbreak\n\t}\n\n\tlog.Printf(\"%s -\u003e %s\", key, val)\n}\n```\n\n## Author\n\nvoidDB builds upon ideas in the celebrated [Lightning Memory-Mapped Database\nManager](http://www.lmdb.tech/doc/) on several key points of its high-level\ndesign, but otherwise it is implemented from scratch to break free of\nlimitations in function, performance, and clarity.\n\nvoidDB is a cherished toy, a journey into the Unknown, a heroic struggle, and a\nwork of love. It is the “Twee!” of a bird; a tree falling in the forest; yet\nanother programmer pouring their drop into the proverbial [bit] bucket. Above\nall, it is a shrine unto simple, readable, and functional code; an assertion\nthat the dichotomy between such aesthetics and practical performance is mere\nillusion.\n\nCopyright 2024 Joel Ling\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FvoidDB%2FvoidDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FvoidDB%2FvoidDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FvoidDB%2FvoidDB/lists"}