Wiaoj.BloomFilter
0.3.0-alpha.1
This is a prerelease version of Wiaoj.BloomFilter.
dotnet add package Wiaoj.BloomFilter --version 0.3.0-alpha.1
NuGet\Install-Package Wiaoj.BloomFilter -Version 0.3.0-alpha.1
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="Wiaoj.BloomFilter" Version="0.3.0-alpha.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wiaoj.BloomFilter" Version="0.3.0-alpha.1" />
<PackageReference Include="Wiaoj.BloomFilter" />
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 Wiaoj.BloomFilter --version 0.3.0-alpha.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Wiaoj.BloomFilter, 0.3.0-alpha.1"
#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 Wiaoj.BloomFilter@0.3.0-alpha.1
#: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=Wiaoj.BloomFilter&version=0.3.0-alpha.1&prerelease
#tool nuget:?package=Wiaoj.BloomFilter&version=0.3.0-alpha.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Wiaoj.BloomFilter
Production-grade, high-throughput Bloom Filter engine for .NET.
Features hardware SIMD acceleration (AVX2 Vector256 / SSE2 Vector128), lock-free read paths, LOH-safe sharding, scalable layered growth, sliding-window rotation, atomic filesystem persistence, and background lifecycle workers.
Installation
dotnet add package Wiaoj.BloomFilter
Architectural Engines
1. InMemoryBloomFilter
- High-speed single bit array renting 64-bit unsigned integer buffers from
ArrayPool<ulong>.Shared. - Vectorized Bit Checking: Uses
Vector256<ulong>(AVX2) andVector128<ulong>(SSE2) to evaluate multiple hash iterations simultaneously. - Snapshot Integrity: Writes 32-byte header containing checksum, fingerprint, and size to ensure snapshot compatibility.
2. ShardedBloomFilter
- Partitions large capacities into $2^N$ independent
InMemoryBloomFiltershards. - Single-pass 128-bit hash execution: upper bits route to the shard index while lower bits evaluate the Kirsch-Mitzenmacher sequence, eliminating double-hashing overhead.
- Eliminates Large Object Heap (LOH) fragmentation for filters with millions of items.
3. ScalableBloomFilter
- Automatically scales capacity by spawning new leaf layers when the current layer's fill ratio reaches the saturation threshold.
- Geometric Tightening: Each subsequent layer is spawned with a tightened error rate ($p_i = p_{i-1} \cdot 0.85$, Almeida et al., 2007) ensuring the cumulative false positive probability across all layers remains within the initial target.
4. RotatingBloomFilter
- Time-to-Live (TTL) sliding-window filter with pre-allocated sliding shards.
- Uses
TryEnterWriteLock(0)to prevent lock convoys and thundering herd spikes during window transitions. - Queries span all active time windows; expired windows are evicted automatically.
Storage & Persistence
FileSystemBloomFilterStorage
- Persists snapshots to local disk using atomic file replacements (
File.Movewith temporary files). - Supports transparent GZip compression (
storage.EnableCompression = true). - Configured via
builder.UseFileSystemStorage(...)extension overloads. - Fail-fast validation prevents data corruption on non-seekable streams.
Background Lifecycle Services
BloomFilterAutoSaveService: Periodically persists dirty filters to storage using background timers.BloomFilterWarmUpService: Preloads and initializes filters during application startup.BloomFilterSeedingService: Hydrates empty filters on first boot from registeredIAutoBloomFilterSeederinstances without re-running on legitimately empty tables.
Registration Example
builder.Services.AddBloomFilter(builder => {
// Persistent storage configuration
builder.UseFileSystemStorage(storage => {
storage.Path = "BloomData";
storage.EnableCompression = true;
});
// Lifecycle services
builder.AddAutoSave();
builder.AddWarmUp();
builder.AddAutoReseed();
// 1. InMemory filter
builder.AddFilter<UserSessionTag>("sessions", 1_000_000, 0.01);
// 2. Sharded filter (LOH-safe, power-of-two partitions)
builder.AddShardedFilter<CatalogTag>("catalog", expectedItems: 5_000_000, errorRate: 0.01, shardCount: 8);
// 3. Scalable filter (dynamic layered growth)
builder.AddScalableFilter<TransactionTag>("transactions", initialCapacity: 100_000, errorRate: 0.001);
// 4. Rotating filter (time-windowed sliding expiration)
builder.AddRotatingFilter<RateLimitTag>("rate-limits", capacity: 500_000, errorRate: 0.01, windowSize: TimeSpan.FromHours(1), shardCount: 6);
});
License
This project is licensed under the MIT License.
| Product | Versions 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.
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Wiaoj.BloomFilter.Abstractions (>= 0.3.0-alpha.1)
- Wiaoj.Concurrency (>= 0.3.0-alpha.1)
- Wiaoj.Primitives (>= 0.3.0-alpha.1)
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 |
|---|---|---|
| 0.3.0-alpha.1 | 46 | 10/5/2026 |
| 0.2.0-alpha.3 | 56 | 9/24/2026 |
| 0.2.0-alpha.2 | 52 | 9/24/2026 |
| 0.2.0-alpha.1 | 51 | 9/24/2026 |
| 0.1.0-alpha.9 | 55 | 9/21/2026 |
| 0.1.0-alpha.8 | 50 | 9/21/2026 |
| 0.1.0-alpha.7 | 61 | 9/18/2026 |
| 0.1.0-alpha.6 | 59 | 9/16/2026 |
| 0.1.0-alpha.5 | 61 | 9/16/2026 |
| 0.1.0-alpha.4 | 59 | 9/16/2026 |
| 0.1.0-alpha.3 | 53 | 9/15/2026 |
| 0.1.0-alpha.2 | 53 | 9/15/2026 |
| 0.1.0-alpha.1 | 55 | 9/14/2026 |
| 0.0.1-alpha.112-preview | 58 | 9/13/2026 |
| 0.0.1-alpha.111-preview | 59 | 9/13/2026 |
| 0.0.1-alpha.110-preview | 55 | 9/12/2026 |
| 0.0.1-alpha.109-preview | 63 | 9/11/2026 |
| 0.0.1-alpha.108-preview | 71 | 9/8/2026 |
| 0.0.1-alpha.107-preview | 71 | 9/8/2026 |
| 0.0.1-alpha.106-preview | 66 | 9/8/2026 |
Loading failed