Skip to content

Commit

Permalink
datastore: disable compaction (fixes 2x memory issue) (#1535)
Browse files Browse the repository at this point in the history
* disable compaction until we support batching

* link

* make it configurable
  • Loading branch information
teh-cmc authored Mar 9, 2023
1 parent a0c4189 commit baad9be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions crates/re_arrow_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ pub struct DataStoreConfig {
///
/// See [`DataStore::insert_id_key`].
pub store_insert_ids: bool,

/// Should soon-to-be inactive buckets be compacted before being archived?
pub enable_compaction: bool,
}

impl Default for DataStoreConfig {
Expand All @@ -193,6 +196,11 @@ impl DataStoreConfig {
index_bucket_size_bytes: 32 * 1024, // 32kiB
index_bucket_nb_rows: 1024,
store_insert_ids: cfg!(debug_assertions),
// TODO(cmc): Compaction is disabled until we implement batching.
// See https://github.com/rerun-io/rerun/pull/1535 for rationale.
//
// This has no noticeable impact on performance.
enable_compaction: false,
};
}

Expand Down
6 changes: 4 additions & 2 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,9 @@ impl ComponentTable {
"allocating new component bucket, previous one overflowed"
);

// Archive currently active bucket.
active_bucket.archive();
if config.enable_compaction {
active_bucket.archive();
}

let row_offset = active_bucket.row_offset + len;
self.buckets
Expand Down Expand Up @@ -1215,6 +1216,7 @@ impl ComponentBucket {
/// Archives the bucket as a new one is about to take its place.
///
/// This is a good opportunity to run compaction and other maintenance related tasks.
#[allow(dead_code)]
pub fn archive(&mut self) {
crate::profile_function!();

Expand Down
1 change: 1 addition & 0 deletions crates/re_arrow_store/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub fn all_configs() -> impl Iterator<Item = DataStoreConfig> {
index_bucket_size_bytes: idx.index_bucket_size_bytes,
index_bucket_nb_rows: idx.index_bucket_nb_rows,
store_insert_ids: comp.store_insert_ids || idx.store_insert_ids,
enable_compaction: comp.enable_compaction || idx.enable_compaction,
})
})
}

1 comment on commit baad9be

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: baad9be Previous: a0c4189 Ratio
datastore/insert/batch/rects/insert 542755 ns/iter (± 7157) 544261 ns/iter (± 7746) 1.00
datastore/latest_at/batch/rects/query 1813 ns/iter (± 29) 1777 ns/iter (± 21) 1.02
datastore/latest_at/missing_components/primary 350 ns/iter (± 7) 351 ns/iter (± 4) 1.00
datastore/latest_at/missing_components/secondaries 417 ns/iter (± 7) 410 ns/iter (± 5) 1.02
datastore/range/batch/rects/query 143993 ns/iter (± 2633) 145353 ns/iter (± 2072) 0.99
mono_points_arrow/generate_message_bundles 43140743 ns/iter (± 1198148) 44933418 ns/iter (± 1628532) 0.96
mono_points_arrow/generate_messages 122067453 ns/iter (± 1456953) 122775580 ns/iter (± 1385766) 0.99
mono_points_arrow/encode_log_msg 149247724 ns/iter (± 1455404) 148283913 ns/iter (± 1577545) 1.01
mono_points_arrow/encode_total 317405627 ns/iter (± 2788648) 315642136 ns/iter (± 2493831) 1.01
mono_points_arrow/decode_log_msg 171066566 ns/iter (± 1615566) 173220112 ns/iter (± 1714685) 0.99
mono_points_arrow/decode_message_bundles 62717435 ns/iter (± 1014836) 63035296 ns/iter (± 844766) 0.99
mono_points_arrow/decode_total 235269855 ns/iter (± 3565675) 234241203 ns/iter (± 2478412) 1.00
batch_points_arrow/generate_message_bundles 320510 ns/iter (± 4271) 321353 ns/iter (± 5079) 1.00
batch_points_arrow/generate_messages 5975 ns/iter (± 109) 5982 ns/iter (± 90) 1.00
batch_points_arrow/encode_log_msg 355048 ns/iter (± 3889) 359440 ns/iter (± 4053) 0.99
batch_points_arrow/encode_total 697693 ns/iter (± 8053) 696682 ns/iter (± 8564) 1.00
batch_points_arrow/decode_log_msg 343191 ns/iter (± 3228) 341016 ns/iter (± 3062) 1.01
batch_points_arrow/decode_message_bundles 2025 ns/iter (± 29) 2024 ns/iter (± 31) 1.00
batch_points_arrow/decode_total 347596 ns/iter (± 3611) 349163 ns/iter (± 3289) 1.00
arrow_mono_points/insert 6003074553 ns/iter (± 23326006) 5968647020 ns/iter (± 17782098) 1.01
arrow_mono_points/query 1679289 ns/iter (± 25419) 1646371 ns/iter (± 22599) 1.02
arrow_batch_points/insert 2614748 ns/iter (± 25060) 2573089 ns/iter (± 30807) 1.02
arrow_batch_points/query 16198 ns/iter (± 237) 16294 ns/iter (± 269) 0.99
arrow_batch_vecs/insert 41160 ns/iter (± 556) 41311 ns/iter (± 586) 1.00
arrow_batch_vecs/query 485638 ns/iter (± 5398) 486457 ns/iter (± 6856) 1.00
tuid/Tuid::random 33 ns/iter (± 0) 33 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.