Crates.io | disk-queue |
lib.rs | disk-queue |
version | 0.1.1 |
source | src |
created_at | 2022-09-05 23:52:37.967469 |
updated_at | 2022-09-06 00:00:26.077092 |
description | FIFO queue backed by disk |
homepage | https://github.com/aprimadi/disk-queue |
repository | https://github.com/aprimadi/disk-queue |
max_upload_size | |
id | 659176 |
size | 55,646 |
FIFO queue backed by disk.
use disk_queue::DiskQueue;
let mut queue = DiskQueue::open("test.db");
queue.enqueue("https://sahamee.com".as_bytes().to_vec());
let item = queue.dequeue().unwrap();
let s = std::str::from_utf8(&item).unwrap();
println!("{}", s); // print "https://sahamee.com"
Benchmark is done with the following machine:
We use fixed size record of length 6 to perform write / read (enqueue / dequeue).
Measured write throughput is about 9.7M writes/sec. This is about 58 MB/sec.
Measured read throughput is about 10.0 writes/sec. This is about 60 MB/sec.
The size of the item stored in the queue cannot be greater than 4089 bytes. This is due to the page size is set to 4096 bytes (4KB). If you need to store items larger than 4089 bytes, consider forking this repository and change the page size.
That being said, performance will degrade as the item size gets larger (> 512 bytes) because it needs to perform file copy frequently.