-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-12536][Runtime/Network]Make BufferOrEventSequence#getNext non blocking #8895
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
[FLINK-12536][Runtime/Network]Make BufferOrEventSequence#getNext non blocking #8895
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
|
Travis build failed seems irrelevant, have filed a issue to track it. |
StephanEwen
left a comment
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.
As I also mentioned in the JIRA discussion I am unsure about this change.
This is adding a lot of extra complexity for a legacy code path for a situation where we don't yet know whether this is a problem in practice.
When trading off overall project code complexity with possibly improved behavior, I am not sure we should change this here.
I think we need to solve that discussion first...
| */ | ||
| public static void readFully(FileChannel fileChannel, ByteBuffer buffer) throws IOException { | ||
| int toRead = buffer.limit() - buffer.position(); | ||
| while (toRead > 0) { |
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 can be simplified to while (buffer.hasRemaining())
|
|
||
| public abstract BufferFileReader createBufferFileReader(FileIOChannel.ID channelID, RequestDoneCallback<Buffer> callback) throws IOException; | ||
|
|
||
| public abstract BufferFileReader createBufferOrEventFileReader(FileIOChannel.ID channelID, RequestDoneCallback<Buffer> callback) throws IOException; |
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.
If we go forward, I would suggest to factor this out into an interface (that is also implemented by IOManager) so we do not pass such a big dependency. This component does not need to know about the IOManager as a whole if it is only interested in this sub-functionality.
|
|
||
| private void readBufferOrEventMeta(ByteBuffer buffer) { | ||
| // ignore channel. | ||
| buffer.order(ByteOrder.LITTLE_ENDIAN); |
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.
Passing the values through fields seems like passing information sideways or through side effects.
If you want to avoid object creation for the return type, I would suggest to look at splitting the methods differently.
|
@StephanEwen thanks for the comments, I'll continue after the discussion has been solved. |
|
closed the pr, as this issue won't do. |
What is the purpose of the change
Currently it is non-blocking in case of credit-based flow control (default), however for SpilledBufferOrEventSequence it is blocking on reading from file. We might want to consider reimplementing it to be non blocking with CompletableFuture<?> isAvailable() method.
Otherwise we will block mailbox processing for the duration of reading from file - for example we will block processing time timers and potentially in the future network flushes.
Brief change log
Use a ByteBuffer pool to read the BufferOrEvent asynchronous.
taskmanager.memory.async-load.buffer-countIOManagerVerifying this change
This change is already covered by existing tests, such as:
SpilledBufferOrEventSequenceTest.javaDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation