-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: support configurable I/O space to drain at a time in edge-trigg… #644
feat: support configurable I/O space to drain at a time in edge-trigg… #644
Conversation
gnet.go
Outdated
@@ -418,6 +418,8 @@ func (*BuiltinEventEngine) OnTick() (delay time.Duration, action Action) { | |||
// MaxStreamBufferCap is the default buffer size for each stream-oriented connection(TCP/Unix). | |||
var MaxStreamBufferCap = 64 * 1024 // 64KB | |||
|
|||
var DefaultEdgeTriggeredIOSpace = 1 << 20 |
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.
Add a comment for this new exported variable.
eventloop_unix.go
Outdated
@@ -152,7 +150,7 @@ loop: | |||
_, _ = c.inboundBuffer.Write(c.buffer) | |||
c.buffer = c.buffer[:0] | |||
|
|||
if c.isEOF || (isET && recv < maxBytesTransferET) { | |||
if c.isEOF || (isET && recv < el.engine.opts.EdgeTriggeredIOSpace) { |
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.
Declare a new local variable for this, like isET
.
options.go
Outdated
@@ -268,3 +272,10 @@ func WithEdgeTriggeredIO(et bool) Option { | |||
opts.EdgeTriggeredIO = et | |||
} | |||
} | |||
|
|||
// WithEdgeTriggeredIOSpace set number of bytes that gnet can read/write up to in one event loop of ET. |
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.
// WithEdgeTriggeredIOSpace sets the number of bytes that gnet can read/write up to in one event loop of ET.
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.
Please add some tests for this, on the server and client sides.
I haven't got a response to my request about adding new tests for almost a week, so I've created #646, thank you for the efforts here. |
…ered mode(#643)
1. Are you opening this pull request for bug-fixes, optimizations or new feature?
new feature
2. Please describe how these code changes achieve your intention.
在eventloop_unix.go中将read/write函数中以前的maxBytesTransferET移除变更为了配置的值,对EdgeTriggeredIOSpace配置进行了初始化。
3. Please link to the relevant issues (if any).
#643
4. Which documentation changes (if any) need to be made/updated because of this PR?
4. Checklist