Aiursoft.ArrayDb.ReadLruCache
1.0.1
See the version list below for details.
dotnet add package Aiursoft.ArrayDb.ReadLruCache --version 1.0.1
NuGet\Install-Package Aiursoft.ArrayDb.ReadLruCache -Version 1.0.1
<PackageReference Include="Aiursoft.ArrayDb.ReadLruCache" Version="1.0.1" />
paket add Aiursoft.ArrayDb.ReadLruCache --version 1.0.1
#r "nuget: Aiursoft.ArrayDb.ReadLruCache, 1.0.1"
// Install Aiursoft.ArrayDb.ReadLruCache as a Cake Addin #addin nuget:?package=Aiursoft.ArrayDb.ReadLruCache&version=1.0.1 // Install Aiursoft.ArrayDb.ReadLruCache as a Cake Tool #tool nuget:?package=Aiursoft.ArrayDb.ReadLruCache&version=1.0.1
Aiursoft ArrayDb
Aiursoft ArrayDb is a lightweight, efficient database engine optimized for storing fixed-length data with constant-time indexing performance (O(1)). ArrayDb is ideal for scenarios where fast, reliable storage and access to time-sequenced or resource-utilization data are essential, making it a strong choice for logging, telemetry, and performance tracking use cases.
Key Design Principles of ArrayDb
Unlike traditional databases, which can struggle with high-frequency data storage requirements, ArrayDb is purpose-built for append-only, fixed-length data storage. It stores entries as continuous, fixed-length data blocks, optimized for minimal read/write operations, ensuring high performance on both SSDs and HDDs.
ArrayDb organizes data into two categories:
- Fixed-Length Attributes: These attributes, such as integers,
DateTime
, and booleans, are stored in a fixed-length array, facilitating fast O(1) access by index. - Variable-Length Attributes: For data like strings, ArrayDb maintains a separate variable-length array, where each entry contains a pointer in the fixed-length array for fast access.
Advantages of ArrayDb
- High-Speed Access: ArrayDb stores each element sequentially on disk. By calculating an element’s exact location based on its index, ArrayDb can retrieve or count elements in constant time, O(1).
- Optimized Append Performance: New entries are simply appended, which maintains data consistency and reduces disk fragmentation. This approach also ensures sustained high-speed write performance, even under heavy load.
- Efficient Reads: Reading from ArrayDb only requires a single disk operation to load all columns in an entry, which contrasts with traditional columnar storage that performs multiple reads for each column.
Limitations
ArrayDb is designed for simplicity and speed but with limited data manipulation:
- No Structural Modifications: The structure of stored data cannot be edited after creation.
- Append-Only: Supports only appending new entries; no item deletions or mid-array insertions are allowed.
- Limited Updates: Modifying variable-length data (e.g., resizing strings) is not supported.
Best Use Cases for ArrayDb
- Fixed-Length Data: Suitable for storing time-series data, such as CPU or memory usage metrics.
- Time-Based Indexing: Ideal for sequential logging or telemetry data, where entries are naturally appended and queried by timestamp.
Read-Write Performance Difference
Large-scale writes are significantly faster than reads because ArrayDb optimizes writes by pre-arranging data (including strings) in memory. This enables sequential, continuous writes to disk, minimizing disk-seeking time to O(1).
In contrast, reads require accessing each string or variable-length attribute individually, creating random access patterns due to potential data fragmentation. As a result, reading incurs a higher O(n) disk-seeking time, where n is the element count. ArrayDb uses an LRU cache to reduce physical disk reads, but in multi-threaded reads, this cache introduces high CPU load.
How to use ArrayDb
Unlike MySQL, working as a process, ArrayDb works as a library. You can use ArrayDb in your C# project by adding the ArrayDb
NuGet package to your project.
mkdir LearnArrayDb
cd LearnArrayDb
dotnet new console
dotnet add package Aiursoft.ArrayDb.Partitions
That's it. Now you have ArrayDb in your project. You can start using it by creating a new Partition
object.
## How to contribute
There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.
Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.
We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Aiursoft.ArrayDb.FilePersists (>= 1.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Aiursoft.ArrayDb.ReadLruCache:
Package | Downloads |
---|---|
Aiursoft.ArrayDb.StringRepository
Nuget package of 'StringRepository' provided by Aiursoft |
GitHub repositories
This package is not used by any popular GitHub repositories.