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

os: Transaction uses append_hole() to minimize bl:_buffers inflation. #24459

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

rzarzynski
Copy link
Contributor

This could be useful as the currently employed ::append(const ptr&) variant does not provide any measures (like coalescing adjacent bptrs) to prevent inflation of the internal structures of a bufferlist. That is, each call was reflected in dynamic node allocation for the _buffers list. Secondary effect of this behavior is increased iteration cost driven by large number of elements likely scattered over memory.

This is derivative work of PR #24229.

{
bufferptr other_op_bl_ptr(other.op_bl.length());
other.op_bl.copy(0, other.op_bl.length(), other_op_bl_ptr.c_str());
other_op_bl.append(std::move(other_op_bl_ptr));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a side quest about std::move.

@@ -491,12 +486,7 @@ namespace buffer CEPH_BUFFER_API {
iterator(bl_t *l, unsigned o=0);
iterator(bl_t *l, unsigned o, list_iter_t ip, unsigned po);

#ifdef BL_BACKWARD_COMPAT
void advance(int o);
Copy link
Contributor

Choose a reason for hiding this comment

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

my concern is that this could break existing librados clients at compile-time and run-time, which still call buffer::list::iterator::advance(int).

at compile time, we will have:

use of deleted function ‘void ceph::list::iterator::advance(int)’

at run-time, we will have

./test: symbol lookup error: ./test: undefined symbol: _ZN4ceph6buffer3Foo4funcEi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was afraid about the backward compatibility as too. However, @liewegas pointed out we need to care only between minor releases. If my understanding is correct, then it would be enough just to not backport such changes.

Copy link
Contributor

@tchaikov tchaikov Oct 8, 2018

Choose a reason for hiding this comment

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

we do have compatibility tests which

  1. install librados client of an old version, for example, mimic, using rpm/deb
  2. backup the executable of the client to somewhere
  3. install librados of current version, i.e., nautilus, using rpm/deb
  4. put back the executable
  5. run it.

see

for examples of how we broke/fixed the ABI before.

Copy link
Member

Choose a reason for hiding this comment

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

Hrm, I thought this was only a problem when we did it in a minor bugfix update. @jdurgin ?

Copy link
Member

Choose a reason for hiding this comment

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

Oh we've made that argument before, but if that's our claim we also probably need to get better about bumping the librados version and shipping multiple versions within each release cycle so that users have a sane upgrade cycle for their clients as well as their servers. :/

Copy link
Member

Choose a reason for hiding this comment

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

the reason we don't bump the so version is because these sorts of changes only affect the C++ interface, but librados.so also contains the C library, which libvirt, qemu, and others depend on.

Since c++ build changes already break the ABI regularly between major versions, I'm fine with doing that. I guess the concern is more around API changes.

Copy link
Contributor

@tchaikov tchaikov Oct 9, 2018

Choose a reason for hiding this comment

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

i managed to break the C++ ABI couple times before. before breaking it again, i think we probably need to take the following issues into consideration, otherwise we will need to revert this change later

cc @dillaman

@gregsfortytwo
Copy link
Member

The new patch here (just the final one in ObjectStore, right?) LGTM, anyway.

This could be useful as the used `::append(const ptr&)` variant does
not provide any measures (like coalescing adjacent bptrs) to prevent
inflation of the internal structures of a bufferlist. That is, each
call was reflected in dynamic node allocation for the `_buffers` list.
Secondary effect of this behavior is increased iteration cost driven
by large number of elements likely scattered over memory.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
@rzarzynski rzarzynski force-pushed the wip-os-transaction-append_hole branch from 208e0ef to bf67929 Compare October 31, 2018 22:53
@rzarzynski
Copy link
Contributor Author

Rebased to current master. As #24229 is already merged, I believe this one is ready to go.

@liewegas liewegas merged commit bf67929 into ceph:master Nov 9, 2018
liewegas added a commit that referenced this pull request Nov 9, 2018
* refs/pull/24459/head:
	os: Transaction uses append_hole() to minimize bl:_buffers inflation.

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants