Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-3244. Improve write efficiency by opening RocksDB only once #709

Merged
merged 4 commits into from
Apr 9, 2020

Conversation

runzhiwang
Copy link
Contributor

@runzhiwang runzhiwang commented Mar 23, 2020

What changes were proposed in this pull request?

What's the problem ?

  1. when datanode create a new container, a new RocksDB instance will be
    created in HddsDispatcher.WriteChunk , but then the created RocksDB was closed, until HddsDispatcher.PutBlock the RocsDB will be opend again and then put it into cache, so the RocksDB was open twice in each datanode. Becase RocksDB.open cost about 200ms, so open it twice is a waste.

How to fix it ?

  1. Put the RocksDB handler into cache when open it the first time , to avoid open it again in HddsDispatcher.PutBlock.

What is the link to the Apache JIRA

https://issues.apache.org/jira/projects/HDDS/issues/HDDS-3244

How was this patch tested?

Existed UT and IT.

@runzhiwang
Copy link
Contributor Author

@bharatviswa504 Could you help review this patch ? If you agree with the change, I will fix the CI failure. Thank you very much.

@runzhiwang runzhiwang force-pushed the open-rocksdb-once branch 3 times, most recently from b55237d to a145399 Compare March 27, 2020 10:50
@runzhiwang runzhiwang closed this Mar 27, 2020
@runzhiwang runzhiwang reopened this Mar 27, 2020
@runzhiwang runzhiwang closed this Mar 31, 2020
@runzhiwang runzhiwang reopened this Mar 31, 2020
@runzhiwang
Copy link
Contributor Author

@bharatviswa504 Could you help review it again.

ReferenceCountedDB db =
new ReferenceCountedDB(store, dbFile.getAbsolutePath());
//add db handler into cache
BlockUtils.addDB(db, dbFile.getAbsolutePath(), conf);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think its better to update the cache only at the end of function "createContainerMetaData" so that even if the chunk dir creation fails, it won't be added to the container cache.

@bshashikant bshashikant merged commit b50e932 into apache:master Apr 9, 2020
@runzhiwang runzhiwang deleted the open-rocksdb-once branch April 20, 2020 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants