This commit is contained in:
abbycin 2025-11-04 15:19:36 +08:00
parent e655952829
commit e681c88cd5
Signed by: abby
GPG Key ID: B636E0F0307EF8EB
3 changed files with 13 additions and 8 deletions

View File

@ -4,7 +4,8 @@ version = "0.1.0"
edition = "2024"
[dependencies]
mace = { git = "https://github.com/abbycin/mace" }
# mace = { git = "https://github.com/abbycin/mace" }
mace = { path = "/home/workspace/gits/github/mace" }
clap = { version = "4.5.48", features = ["derive"] }
rand = "0.9.2"
log = "0.4.22"

View File

@ -1,5 +1,6 @@
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <fmt/format.h>
#include <memory>
#include <random>
@ -80,7 +81,7 @@ int main(int argc, char *argv[]) {
rocksdb::ColumnFamilyOptions cfo{};
cfo.enable_blob_files = true;
cfo.min_blob_size = 1024;
cfo.min_blob_size = 8192;
// use 1GB block cache
auto cache = rocksdb::NewLRUCache(1 << 30);
rocksdb::BlockBasedTableOptions table_options{};
@ -204,9 +205,9 @@ int main(int argc, char *argv[]) {
return args.insert_ratio;
return args.mode == "insert" ? 100 : 0;
}();
double ops = static_cast<double>(total_op.load(std::memory_order_relaxed)) / b.elapse_sec();
fmt::println("{},{},{},{},{},{:.2f},{}", args.mode, args.threads, args.key_size, args.value_size, ratio, ops,
b.elapse_ms());
uint64_t ops = total_op.load(std::memory_order_relaxed) / b.elapse_sec();
fmt::println("{},{},{},{},{},{},{}", args.mode, args.threads, args.key_size, args.value_size, ratio, (uint64_t) ops,
(uint64_t) b.elapse_ms());
delete handle;
delete db;
std::filesystem::remove_all(args.path);

View File

@ -41,6 +41,9 @@ struct Args {
#[arg(long, default_value = "false")]
random: bool,
#[arg(long, default_value = "8192")]
blob_size: usize,
}
fn main() {
@ -76,11 +79,11 @@ fn main() {
let mut keys: Vec<Vec<Vec<u8>>> = Vec::with_capacity(args.threads);
let mut opt = Options::new(path);
opt.sync_on_write = false;
opt.max_inline_size = 1024;
opt.over_provision = true; // large value will use lots of memeory
opt.inline_size = args.blob_size;
opt.tmp_store = args.mode != "get";
let mut saved = opt.clone();
saved.tmp_store = false;
// opt.cache_capacity = 3 << 30; // this is very important for large key-value store
let mut db = Mace::new(opt.validate().unwrap()).unwrap();
db.disable_gc();
@ -181,7 +184,7 @@ fn main() {
let test_start = start_time.lock().unwrap();
let duration = test_start.elapsed();
let total = total_ops.load(std::sync::atomic::Ordering::Relaxed);
let ops = total as f64 / duration.as_secs_f64();
let ops = (total as f64 / duration.as_secs_f64()) as usize;
// println!("{:<20} {}", "Test Mode:", args.mode);
// println!("{:<20} {}", "Threads:", args.threads);