-
Notifications
You must be signed in to change notification settings - Fork 14
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
Delay block in place #454
Delay block in place #454
Conversation
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.
Seems there are tests failing?
@@ -569,7 +570,7 @@ impl DiskBufferRequester { | |||
.send(BufferCmd::GetPage((space_id, page_id), resp_tx)) | |||
.map_err(StoreError::Send) | |||
.ok(); | |||
resp_rx.blocking_recv().unwrap() | |||
block_in_place(move || resp_rx.blocking_recv().unwrap()) |
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 guessing that you don't need this here because you're not in an async function
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.
+1 will it work if not in an async call?
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.
Without this, all the tests fail. This code does nothing if you're not in an async context. If you are, then it moves you to a blockable thread to prevent interference with the async runtime.
|
It's safe to call `block_in_place` if we're not in an async runtime, or even to do it recursively. The docs suggest you defer calling it until you know you're about to actually block. This removes the calls from several locations and puts them all in the one blocking call we have -- the one that reads from the cache. This didn't make a big difference, but it does eliminate the extra overhead of moving things over to another thread prematurely. Will attach flamegraphs of 1,000 inserts.
Added a block_in_place to resolve the last test issue
82b34ec
to
f733f08
Compare
We can delay calling
block_in_place
until we actually block. This results in a small performance gain, probably more noticeable when we start doing reads in parallel.Before:
After