Skip to content

fix rocksdb block cache size#122

Merged
andresilva merged 3 commits into
masterfrom
ao-fix-block-cache-size
May 7, 2019
Merged

fix rocksdb block cache size#122
andresilva merged 3 commits into
masterfrom
ao-fix-block-cache-size

Conversation

@ordian
Copy link
Copy Markdown
Contributor

@ordian ordian commented Apr 11, 2019

LRU block cache size was limited by 8 bytes, instead of 8 MB.

@ordian ordian changed the title fix block cache size fix rocksdb block cache size Apr 11, 2019
Comment thread kvdb-rocksdb/src/lib.rs Outdated
{
block_opts.set_block_size(config.compaction.block_size);
let cache_size = cmp::max(8, config.memory_budget() / 3);
let cache_size = cmp::max(8 * MB, config.memory_budget() / 3);
Copy link
Copy Markdown
Contributor Author

@ordian ordian Apr 11, 2019

Choose a reason for hiding this comment

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

I wonder where does this / 3 come from, should it be / columns?
EDIT: probably not, but still curious.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One option is to simply take config.memory_budget() / 3 and assume that if someone changes that to something below 24MB they know what they're doing? This 8MB minimum strikes me as a bit opaque.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, I agree with David, that it may be surprising for a user. Although, in practice, most of the time it only makes sense to use the default cache size or to increase it, which won't affect the maximum. I'll push a commit to remove it.

Comment thread kvdb-rocksdb/src/lib.rs Outdated
{
block_opts.set_block_size(config.compaction.block_size);
let cache_size = cmp::max(8, config.memory_budget() / 3);
let cache_size = cmp::max(8 * MB, config.memory_budget() / 3);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@andresilva
Copy link
Copy Markdown
Contributor

One thing that we could improve is that we divide our memory budget evenly across all column families. But in reality, e.g. in parity-ethereum probably 90% of the data exists on the state column family, so maybe we should cache more aggressively there.

Comment thread kvdb-rocksdb/src/lib.rs Outdated
{
block_opts.set_block_size(config.compaction.block_size);
let cache_size = cmp::max(8, config.memory_budget() / 3);
let cache_size = cmp::max(8 * MB, config.memory_budget() / 3);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One option is to simply take config.memory_budget() / 3 and assume that if someone changes that to something below 24MB they know what they're doing? This 8MB minimum strikes me as a bit opaque.

@andresilva
Copy link
Copy Markdown
Contributor

IIRC 8MB is the rocksdb default. Maybe we can add a comment about that.

@andresilva andresilva merged commit 4310011 into master May 7, 2019
@ordian ordian deleted the ao-fix-block-cache-size branch May 7, 2019 11:44
ordian added a commit that referenced this pull request May 7, 2019
* master:
  uint: faster mul by u64 (#125)
  fix rocksdb block cache size (#122)
  uint: convert benchmarks to criterion  (#123)
  Bump fixed-hash to 0.3.2 (#134)
  Use EntropyRng instead of OsRng (#130)
  Bump parity-crypto to 0.3.1 (#132)
  rust-crypto dependency removal (#85)
  Use newly stablized TryFrom trait for primitive-types (#127)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants