Stellar.FastDB - High Performance Embedded Storage for C# (.NET)

December 21, 2025 · View on GitHub

Stellar.FastDB is an exceptionally fast document store for C# with speeds approximately 100x faster than similar products. Designed for optimal performance and high concurrency, it excels in embedded workflows that demand efficiency.

image Throughput (Records Per Second - Higher is Better)


Key Features

  • Serverless, embedded document storage.
  • Simple, thread-safe API that supports asynchronous programming with async/await.
  • Entirely written in C#, supporting .NET versions 5.0 through 9.0.
  • Delivered as a compact, single DLL (60 kb).
  • Supports multiple concurrent readers and writers.
  • Schema-less NoSQL storage that adapts to changes.
  • Optimized storage footprint with configurable storage formats (JSON, MessagePack).
  • Advanced LZH compression and AES encryption to ensure data security.
  • Parallel processing capabilties for serialization, compression, and encryption.
  • Supports relational querying with LINQ.
  • Ensures end-to-end type safety for data integrity.
  • Accomodates composite keys for complex data structuring.
  • Open source and free for both personal and commercial use.
  • Install from Nuget. Install-Package Stellar.FastDB.

TL;DR

It's essentially a ConcurrentDictionary with built-in persistence.

Benchmarks

A detailed list of benchmarks, along with a reproducible project, is available.

Insert

MethodProductOp/sFileSize
Insert 10,000FastDB192,855653 KB
Insert 10,000VistaDB2,648940 KB
Insert 10,000LiteDB1,2511,656 KB
Insert 10,000SQLite753444 KB

Delete

MethodProductOp/sFileSize
Delete 10,000FastDB164,177653 KB
Delete 10,000VistaDB5,503940 KB
Delete 10,000LiteDB1,2071,664 KB
Delete 10,000SQLite757444 KB

Upsert

MethodProductOp/sFileSize
Upsert 10,000FastDB93,633653 KB
Upsert 10,000LiteDB3,1921,664 KB
Upsert 10,000VistaDB2,372940 KB
Upsert 10,000SQLite741444 KB

Bulk Insert

MethodProductOp/sFileSize
Bulk 10,000SQLite294,455444 KB
Bulk 10,000FastDB226,075653 KB
Bulk 10,000LiteDB44,2198 KB
Bulk 10,000VistaDB2,706952 KB

Query

MethodProductOp/sFileSize
Query 10,000FastDB12,080,699653 KB
Query 10,000SQLite2,227,601444 KB
Query 10,000VistaDB574,299940 KB
Query 10,000LiteDB497,7981,656 KB

Common Questions

Why was Stellar.FasbDB created?

As a game developer, I need a high-concurrency storage solution for player-managed game servers. Requiring players to install local databases isn’t practical. However, most available storage options are either too slow or struggle with concurrent reads and writes. These limitations make them unsuitable for game servers, which require high volume reads and writes without performance issues.

Should I use Stellar.FastDB?

Use Stellar.FastDB if you need:

  • Embedded, durable storage suitable for applications like game servers and desktop apps.
  • Thread safety with robust support for high concurrency.
  • High throughput for both reading and writing data.
  • A minimal data storage footprint.

Do not use this database if you need:

  • Sharing conections between processes.
  • Storing data in a single file.

What additional features are planned for Stellar.FastDB?

  • A memory defragmentation algorithm to further optimize performance.
  • An optional structured storage format with defined schema to further improve storage efficiency.

How to use Stellar.FastDB

  • Stellar.FastDB's APIs are designed to be inuitive and closely resemble .NET collections. If you are familar with using a Dictionary, you'l find the transition to FastDB seamless! By default, all writes to FastDB are immediate consistency, ensuring data integrity.
  • To get started with Stellar.FastDB, install it from NuGet. Search for 'Stellar.FastDB' or use the package manager command 'Install-Package Stellar.FastDB'.

Code Samples

Getting Started

Below is a basic example demonstrating how to interact with Stellar.FastDB. This includes creating a database instance, storing customer data, updating it, retrieving it, and properly closing the database connection:

// create a class
public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
    public DateTime DOB { get; set; }
    public string Phone { get; set; }
    public bool IsActive { get; set; }
}

// create database
FastDB fastDB = new FastDB();

// create a collection (key, value)
var customers = fastDB.GetCollection<int, Customer>();

// create your new customer instance
var customer = new Customer
{
   Id = 1,
   Name = "John Wick", 
   Phone = "555-555-5555"
   DOB = new DateTime(2000, 1, 1)
   IsActive = true
};

// add customer
customers.Add(customer.Id, customer);

// update customer
customer.Name = "John Wick's Dog";
customers.Update(customer);

// use LINQ to query
var matches = customers.Where(a => a.Name.StartsWith("John") && a.Phone != null);

// close database
fastDB.Close();

Encryption

FastDBOptions options = new FastDBOptions()
{
   IsEncrypted = true,
   EncryptionPassword = "open-sesame",
};
FastDB fastDB = new FastDB(options);

Compression

FastDBOptions options = new FastDBOptions()
{
   IsCompressed = true,
};
FastDB fastDB = new FastDB(options);

Large Record Parallelism

For operations involving serialization, compression, or encryption of large records, enabling parallel data transformations can significantly enhance throughput. This method uses multiple processor cores to accelerate write operations.

FastDBOptions options = new FastDBOptions()
{
   BufferMode = BufferModeType.WriteParallelEnabled,
   MaxDegreesOfParallelism = 8,
   IsEncryptionEnabled = true,
   EncryptionPassword = "open-sesame",
   IsCompressed = true,
};
FastDB fastDB = new FastDB(options);
MethodProductOp/sFileSize
LargeFastDB140,47020,096 KB
Large EncryptedFastDB100,43520,205 KB
Large Encrypted CompressedFastDB68,06414,892 KB
Large Enc Cmp ParallelFastDB138,58814,892 KB

Optional Serialization Contracts

To achieve the smallest possible storage footprint, Stellar.FastDB supports serialization contracts using MessagePack. By adding MessagePack attributes to your data models (as shown in the example below), you can instruct the serializer to package the data more efficiently. Note that this feature is disabled by default and is typically not included in most benchmarks.

// create a class
public class Customer
{
    [Key(0)]
    public int Id { get; set; }
    [Key(1)]
    public string Name { get; set; }
    [Key(2)]
    public DateTime DOB { get; set; }
    [Key(3)]
    public string Phone { get; set; }
    [Key(4)]
    public bool IsActive { get; set; }
}

FastDBOptions options = new FastDBOptions()
{
   Serializer = SerializerType.MessagePack_Contract,
};
FastDB fastDB = new FastDB(options);

// create a collection (key, value)
var customers = fastDB.GetCollection<int, Customer>();

// add customer
customers.Add(customer.Id, customer);
customres.Flush()

// close database
fastDB.Close();
SerializerProductOp/sFileSize
Default 10,000FastDB198,628653 KB
Contract 10,000FastDB201,109370 KB

Contact

I may be contacted on the Stellar Conquest Discord (stonstad) and X (stonstad).