-
Notifications
You must be signed in to change notification settings - Fork 153
Improve recursive normalized data read performance #2742
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
base: master
Are you sure you want to change the base?
Conversation
49d4f83 to
8d9256b
Compare
8d9256b to
785f385
Compare
a52e95d to
0b72b38
Compare
| manager.log_info() | ||
|
|
||
| def get_symbol_name(self, symbol_idx=0): | ||
| return f"nested_dict_{self.params[0]}_sym{symbol_idx}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.params[0] is [1000], this doesn't make much sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point was slightly missed. If we added another num_dict_entries parameter (e.g. so it's [1000, 2000], then we will want separate symbol names for the different number of dict entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rewritten this bit to make it less ambiguous, as the data is not persisted anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there already lmdb benchmarks for reading recursively normalized data?
What about for writing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea why not LMDB.
I didn't touch write but yea it's worth adding the write asv test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK cool, can remove the real_ from this filename now then
6f9a6d3 to
407257a
Compare
| } | ||
| } | ||
|
|
||
| inline ReadResult create_python_read_result( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moving existing function to a new place to resolve some circular dependency issue
| return versioned_item; | ||
| } | ||
|
|
||
| auto get_read_and_process_fn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
407257a to
a7c4926
Compare
bb9f7c4 to
8471058
Compare
| } | ||
| } | ||
|
|
||
| inline ReadResult create_python_read_result( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to a .cpp file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been marked inline explicitly so I prefer not to touch that
| py::list node_results; | ||
| for (auto& node_result : ret.node_results) { | ||
| node_results.append(py::make_tuple( | ||
| node_result.symbol_, | ||
| std::move(node_result.frame_data_), | ||
| python_util::pb_to_python(node_result.norm_meta_) | ||
| )); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems duplicated in python_utils.hpp can it be extracted in a function?
| for (const auto& key : keys) { | ||
| node_futures.emplace_back(read_frame_for_version(store(), key, read_query, read_options, handler_data)); | ||
| } | ||
| auto node_trys = folly::collectAll(node_futures).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not wrapping exceptions as in batch data can't we use folly::collect to fail faster? In that case we must be very careful not to have segfaults on failures and make all parameters for the future shared_ptrs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me and Alex have discussion regarding this and we think, as fail faster is not that important here, this implemetation is prefered
Reference Issues/PRs
https://man312219.monday.com/boards/7852509418/pulses/18298965201
What does this implement or fix?
readbatch_read_keysread index keys of individual leaf nodes one by one during submission of read tasks. This PR has made this step runs in parallel in C++ layer.It has shown read performance improvment, espceially on slow network or data with more leaf nodes:
batch_readIt has been changed to unify to code path with
read, Now node keys are read in the same chain of root keys.The performance has not bettered or worsened, as expected.
Any other comments?
ASV benchmark fails because of unreliable arrow and peakmem tests. They can be ignored.
Checklist
Checklist for code changes...