StreamDB 1.0.4

dotnet add package StreamDB --version 1.0.4
                    
NuGet\Install-Package StreamDB -Version 1.0.4
                    
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="StreamDB" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StreamDB" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="StreamDB" />
                    
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 StreamDB --version 1.0.4
                    
#r "nuget: StreamDB, 1.0.4"
                    
#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 StreamDB@1.0.4
                    
#: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=StreamDB&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=StreamDB&version=1.0.4
                    
Install as a Cake Tool

StreamDB

A schema-on-read embedded stream storage engine for time-series data. Built on Microsoft FASTER and SQLite.

What is StreamDB?

StreamDB is purpose-built for workloads where data arrives fast and needs to be queryable by time range — think IoT telemetry, sensor data, event logs, or any append-heavy stream. It pairs FASTER's append-only log for raw throughput with a sparse SQLite index for efficient lookups, giving you the best of both worlds: lock-free writes and bounded-scan reads.

Data Model: Primary & Secondary Indexes

Every record in StreamDB is organized around two index concepts:

Concept Type Purpose
Primary Index long (monotonic key) Range queries and ordering. Every record carries a primary index — commonly a Unix timestamp, but can be any monotonically increasing value (sequence number, score, etc.).
Secondary Index int (grouping key) Sharding and filtering. Represents any logical grouping — device ID, sensor ID, user ID, region, etc.

The primary index determines when (or where in sequence) something happened. The secondary index determines who/what produced it. Together they enable efficient queries like "give me all readings from sensor 42 between primary index 1000 and 2000."

Key Properties

  • Non-blocking writes — appends go to an in-memory FasterLog buffer; no fsync in the hot path
  • Max payload size: 65,535 bytes (≈64 KB) — payload length is stored as a ushort in the record header
  • Adaptive sparse indexing — automatically tunes index density based on write pressure (16x–4096x)
  • Schema-on-read — records carry a version tag; callers deserialize at read time
  • Sharded storage — distributes data across multiple FasterLog instances to reduce contention
  • Automatic retention — configurable data lifecycle with background cleanup
  • Crash recovery — reconciles the sparse index against durable log state on startup

Note: For best performance the primary index should be monotonically increasing per secondary index. Out-of-order writes are handled transparently but incur a small performance penalty (synchronous SQLite write).

Quick Start

using StreamDB;

// Create a StreamDB instance
var db = new StreamDB.StreamDB(
    baseDir: "my-streams",
    retentionPeriod: TimeSpan.FromDays(30),
    jitterWindow: 120, // tolerate 120 units of out-of-order primary index values
    logger: logger
);

// Write — primaryIndex is the primary index, secondaryIndex is the grouping key
db.Append(primaryIndex: pi, secondaryIndex: sensorId, version: 1, payload: bytes);

// Read a range for one secondary index
List<StreamEntry> entries = db.ReadRange(secondaryIndex: sensorId, startPrimaryIndex: from, endPrimaryIndex: to);

// Read across multiple secondary indexes (single scan per shard)
Dictionary<int, List<StreamEntry>> multi = db.ReadRange(
    secondaryIndexes: new[] { sensor1, sensor2, sensor3 }, startPrimaryIndex: from, endPrimaryIndex: to
);

// Monitor health
StreamDbStats stats = db.GetStats();

Project Structure

├── src/StreamDB/              # Core library
├── samples/StreamDB.Sample/   # Console demo
├── tests/StreamDB.Tests/      # NUnit test suite
├── benchmarks/StreamDB.Benchmarks/ # BenchmarkDotNet vs SQLite & RocksDB
├── docs/architecture.md       # Technical documentation
└── LICENSE                    # Apache 2.0

Running the Sample

dotnet run --project samples/StreamDB.Sample

Documentation

See the docs/ directory for detailed technical documentation:

  • Architecture & Internals — write/read paths, adaptive algorithm, concurrency model, recovery, performance characteristics, configuration, and troubleshooting

Dependencies

License

Apache 2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 65 4/8/2026
1.0.3 71 4/8/2026
1.0.1 78 4/6/2026
1.0.0 87 3/27/2026