Skip to content

Commit

Permalink
jsonrpc, rest: reduce batch size to 128MB before writting
Browse files Browse the repository at this point in the history
Reduce the minimum batch size to write out during indexing the live
object set from 256MB to 128MB, these smaller batch sizes resulted in a
small improvement to index initialization.
  • Loading branch information
bmwill committed Oct 16, 2024
1 parent d7e977a commit 814af2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/sui-core/src/jsonrpc_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1747,9 +1747,9 @@ impl<'a> LiveObjectIndexer for CoinLiveObjectIndexer<'a> {
self.batch
.insert_batch(&self.tables.coin_index_2, [(key, value)])?;

// If the batch size grows to greater that 256MB then write out to the DB so that the
// If the batch size grows to greater that 128MB then write out to the DB so that the
// data we need to hold in memory doesn't grown unbounded.
if self.batch.size_in_bytes() >= 1 << 28 {
if self.batch.size_in_bytes() >= 1 << 27 {
std::mem::replace(&mut self.batch, self.tables.coin_index_2.batch()).write()?;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/sui-core/src/rest_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ impl<'a> LiveObjectIndexer for RestLiveObjectIndexer<'a> {
}
}

// If the batch size grows to greater that 256MB then write out to the DB so that the
// If the batch size grows to greater that 128MB then write out to the DB so that the
// data we need to hold in memory doesn't grown unbounded.
if self.batch.size_in_bytes() >= 1 << 28 {
if self.batch.size_in_bytes() >= 1 << 27 {
std::mem::replace(&mut self.batch, self.tables.owner.batch()).write()?;
}

Expand Down

0 comments on commit 814af2a

Please sign in to comment.