MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / wal_group_commit

Function wal_group_commit

nodedb-wal/benches/wal_throughput.rs:63–105  ·  view source on GitHub ↗
(b: &mut Bencher)

Source from the content-addressed store, hash-verified

61 tags = "core"
62)]
63fn wal_group_commit(b: &mut Bencher) {
64 let dir = tempfile::tempdir().unwrap();
65 let path = dir.path().join("bench_gc.wal");
66 let payload = vec![0xCDu8; 128];
67
68 b.iter(|| {
69 let _ = std::fs::remove_file(&path);
70 let writer = Arc::new(Mutex::new(
71 WalWriter::open_without_direct_io(&path).unwrap(),
72 ));
73 let committer = Arc::new(GroupCommitter::new());
74
75 let handles: Vec<_> = (0..10)
76 .map(|t| {
77 let c = Arc::clone(&committer);
78 let w = Arc::clone(&writer);
79 let p = payload.clone();
80 std::thread::spawn(move || {
81 for _ in 0..1000 {
82 c.submit(
83 &w,
84 PendingWrite {
85 record_type: RecordType::Put as u32,
86 tenant_id: t,
87 vshard_id: 0,
88 database_id: 0,
89 payload: p.clone(),
90 },
91 )
92 .unwrap();
93 }
94 })
95 })
96 .collect();
97
98 for h in handles {
99 h.join().unwrap();
100 }
101
102 let w = writer.lock().unwrap();
103 black_box(w.next_lsn())
104 });
105}
106
107// 1000 records per iteration of wal_append_fsync_1k_128b.
108#[synthetic(

Callers

nothing calls this directly

Calls 9

joinMethod · 0.80
collectMethod · 0.80
lockMethod · 0.80
spawnFunction · 0.50
pathMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
submitMethod · 0.45
next_lsnMethod · 0.45

Tested by

no test coverage detected