ZoneTree 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ZoneTree --version 1.0.0
                    
NuGet\Install-Package ZoneTree -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZoneTree" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZoneTree" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ZoneTree" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZoneTree --version 1.0.0
                    
#r "nuget: ZoneTree, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZoneTree@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZoneTree&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ZoneTree&version=1.0.0
                    
Install as a Cake Tool

ZoneTree

ZoneTree is a persistent, high-performance key-value database for .NET. It can operate in memory or on disk. (Optimized for SSDs)

ZoneTree is a fast and high-performance LSM Tree for .NET.

LSM Tree (Log-structured merge-tree) is the most popular data structure and it is being used by many popular databases internally.

Why ZoneTree?

  1. It is pure C#. Easy to maintain, easy to develop new features.
  2. It is faster than using C/C++ based key-value stores like RocksDB. Because ZoneTree does not need to transfer bytes to the native external libraries (Zero Marshaling).
  3. .NET EcoSystem does not have any feature-complete and thread-safe LSM Tree that operates both in memory and on disk.

How fast is it?

2 Million int key and int value inserts in 7 seconds. (Config: 1M mutable segment size, 2M readonly segments merge-threshold)

20 Million int key and int value inserts in 73 seconds. (Config: 1M mutable segment size, 2M readonly segments merge-threshold)

20 Million int key and int value reads in 16 seconds. (Config: 1M mutable segment size, 2M readonly segments merge-threshold)

Doing database benchmark is tough. A proper and fair performance analysis requires a lot of work.

For now, we are confident that ZoneTree is fast enough to be used in production.

How to use ZoneTree?

The following sample demonstrates creating a database.

  var dataPath = "data/mydatabase";
  var walPath = "data/mydatabase/wal";
  using var zoneTree = new ZoneTreeFactory<int, string>()
    .SetComparer(new IntegerComparerAscending())
    .SetDataDirectory(dataPath)
    .SetWriteAheadLogDirectory(walPath)
    .SetKeySerializer(new Int32Serializer())
    .SetValueSerializer(new Utf8StringSerializer())
    .OpenOrCreate();
    
    // upsert a key-value pair.
    zoneTree.Upsert(39, "Hello Zone Tree!");
    // atomically update a record in database. (thread-safe)
    zoneTree.TryAddOrUpdateAtomic(39, "a", (x) => x + "b");

How to maintain LSM Tree?

Big LSM Trees require maintenance tasks. ZoneTree provides the IZoneTreeMaintenance interface to give you full power on maintenance tasks. It also comes with a default maintainer to let you focus on your business logic without wasting time with LSM details. You can start using the default maintainer like in the following sample code. Note: For small data you don't need a maintainer.

  var dataPath = "data/mydatabase";
  var walPath = "data/mydatabase/wal";

  // 1. Create your ZoneTree
  using var zoneTree = new ZoneTreeFactory<int, string>()
    .SetComparer(new IntegerComparerAscending())
    .SetDataDirectory(dataPath)
    .SetWriteAheadLogDirectory(walPath)
    .SetKeySerializer(new Int32Serializer())
    .SetValueSerializer(new Utf8StringSerializer())
    .OpenOrCreate();
 
  using var maintainer = new BasicZoneTreeMaintainer<int, string>(zoneTree);

  // 2. Read/Write data
  zoneTree.Upsert(39, "Hello ZoneTree!");

  // 3. Complete maintainer running tasks.
  maintainer.CompleteRunningTasks().AsTask().Wait();

I need more information. Where can I find it?

I am going to write more detailed documentation as soon as possible.

I want to contribute. What should I do?

I appreciate any contribution to the project. These are the things I do think we need at the moment:

  1. Write tests / benchmarks.
  2. Write documentation.
  3. Convert documentation to a website using static site generators.
  4. Feature requests & bug fixes.
  5. Performance improvements.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on ZoneTree:

Package Downloads
ZoneTree.FullTextSearch

ZoneTree.FullTextSearch is an open-source library that extends ZoneTree to provide efficient full-text search capabilities. It offers a fast, embedded search engine suitable for applications that require high performance and do not rely on external databases.

DifferentialComputeDotNet.Core

Package Description

Bielu.PersistentQueues.Storage.ZoneTree

ZoneTree storage provider for Bielu.PersistentQueues

ZoneTree.Analytics

ZoneTree.Analytics is a lightweight, embeddable, high-performance analytics engine for .NET. It records web analytics, custom events, telemetry and business metrics, and answers time-series, breakdown and unique-visitor queries directly inside your application, using ZoneTree as its storage engine.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on ZoneTree:

Repository Stars
ZoneTree/ZoneTree.FullTextSearch
ZoneTree.FullTextSearch is an open-source library that extends ZoneTree to provide efficient full-text search capabilities. It offers a fast, embedded search engine suitable for applications that require high performance and do not rely on external databases.
Version Downloads Last Updated
2.0.1 4,251 10/11/2026
2.0.0 5,610 10/9/2026
1.9.9 545 10/9/2026
1.9.8 11,326 9/15/2026
1.9.7 3,968 8/4/2026
1.9.6 789 7/15/2026
1.9.5 243 7/14/2026
1.9.4 201 7/7/2026
1.9.3 200 7/5/2026
1.9.2 1,193 6/13/2026
1.9.1 162 6/13/2026
1.9.0 170 6/13/2026
1.8.9 205 6/11/2026
1.8.8 171 6/10/2026
1.8.7 3,759 6/8/2026
1.8.6 12,448 6/14/2025
1.8.5 12,297 1/18/2025
1.8.4 1,143 11/14/2024
1.8.3 556 10/16/2024
1.0.0 665 7/6/2022
Loading failed