Skip to content

Set read buffer to 0 #20

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

Merged
merged 3 commits into from
Sep 9, 2015
Merged

Set read buffer to 0 #20

merged 3 commits into from
Sep 9, 2015

Conversation

cboden
Copy link
Member

@cboden cboden commented May 29, 2015

@cboden cboden added this to the v0.4.3 milestone May 29, 2015
@cboden
Copy link
Member Author

cboden commented May 29, 2015

Courtesy of @mbonneau

@cboden
Copy link
Member Author

cboden commented Jun 2, 2015

I'd like to merge this by June 8th unless any valid objections. ping @clue @WyriHaximus

@@ -113,6 +113,40 @@ public function testClosingStreamInDataEventShouldNotTriggerError()
$conn->handleData($stream);
}

public function testBufferReadsLargeChunks() {
Copy link
Member

Choose a reason for hiding this comment

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

All other methods test the Stream in isolation by mocking the environment (unit tests), while this test uses the environment (integration test). Perhaps move this to a separate test file? (Also, there's a missing newline)

@clue
Copy link
Member

clue commented Jun 2, 2015

The code looks good to me and I'm all for getting this in! 👍 We're already handling our own buffers, so it makes sense to use unbuffered I/O on a lower level.

Given how long it took to trace this (subtle) bug, we should take the time and make sure to not introduce any regressions. In particular:

  • How does this affect file I/O?
  • How does this affect TCP server sockets (socket component)?
  • How does this affect TCP clients (socket-client component)?
  • How does this affect SSL/TLS clients (socket-client component)?
  • Performance regressions?

@@ -24,6 +24,7 @@ public function __construct($stream, LoopInterface $loop)
}

stream_set_blocking($this->stream, 0);
stream_set_read_buffer($this->stream, 0);
Copy link
Member

Choose a reason for hiding this comment

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

So far this only affects reading from the stream – how about also disabling the write buffer?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm leaning towards "if it ain't broke don't fix it". The read buffer is fixing a specific problem. I'm all for trying to set the write buffer to 0 in another PR if we can show it increasing performance or fixing a bug.

Copy link
Member

Choose a reason for hiding this comment

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

if it ain't broke don't fix it

Sounds fair :)

@kingcrunch
Copy link

@cboden What's missing for a merge?

@WyriHaximus
Copy link
Member

LGTM 👍

@mbonneau
Copy link

+1

1 similar comment
@davidwdan
Copy link

👍

@clue
Copy link
Member

clue commented Sep 9, 2015

Given how long it took to trace this (subtle) bug, we should take the time and make sure to not introduce any regressions […]

We have yet to spot any regressions, so I see no point in holding this off any longer. Let's get this in 👍

cboden added a commit that referenced this pull request Sep 9, 2015
@cboden cboden merged commit 5666666 into master Sep 9, 2015
@clue
Copy link
Member

clue commented Sep 18, 2015

Note that this PR introduced an incompatibility with HHVM which is being addressed in #28.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants