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

kv: implement value_as_ptr() and use it in .get() #7052

Merged
merged 2 commits into from Jan 6, 2016

Conversation

branch-predictor
Copy link
Contributor

Current .get() methods return values as bufferlists, which are replacing
bufferlists provided by caller. This is particularly inefficient with
MonitorDBStore, because its get() method uses its own temporary bufferlist
which is then appended to bufferlist provided by MonitorDBStore user.
This changeset:

  • adds value_as_ptr() which returns just a bufferptr
  • modifies *DBStore.get() methods to append returned bufferptr to provided
    bufferlist instead of replacing it
  • modifies mondbstore to pass provided bufferlist as target for underlying
    .get() method, instead of providing its own and appending it to one given
    by caller.

This reduces CPU usage of *DBStore.get() methods by up to 5% (particularly
visible with MonitorDBStore, which doesn't use two temporary bufferlists
anymore, and for some reason queries mon db store every few seconds).

Signed-off-by: Piotr Dałek piotr.dalek@ts.fujitsu.com

Current .get() methods return values as bufferlists, which are replacing
bufferlists provided by caller. This is particularly inefficient with
MonitorDBStore, because its get() method uses its own temporary bufferlist
which is then appended to bufferlist provided by MonitorDBStore user.
This changeset:
 - adds value_as_ptr() which returns just a bufferptr
 - modifies *DBStore.get() methods to append returned bufferptr to provided
   bufferlist instead of replacing it
 - modifies mondbstore to pass provided bufferlist as target for underlying
   .get() method, instead of providing its own and appending it to one given
   by caller.

This reduces CPU usage of *DBStore.get() methods by up to 5% (particularly
visible with MonitorDBStore, which doesn't use two temporary bufferlists
anymore).

Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
… is empty

If it's not, data will be appended to the end of bufferlist and difficult
to spot bugs might arise, so fail hard in that case.

Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
liewegas added a commit that referenced this pull request Jan 6, 2016
kv: implement value_as_ptr() and use it in .get()

Reviewed-by: Sage Weil <sage@redhat.com>
@liewegas liewegas merged commit 03b7860 into ceph:master Jan 6, 2016
@branch-predictor branch-predictor deleted the bp-faster-kv-get branch January 24, 2018 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants