-
-
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
opt: reduce GC pause frequency for Conn.AsyncWrite #218
Conversation
Codecov Report
@@ Coverage Diff @@
## master #218 +/- ##
==========================================
- Coverage 85.41% 85.34% -0.08%
==========================================
Files 18 18
Lines 1193 1187 -6
==========================================
- Hits 1019 1013 -6
Misses 134 134
Partials 40 40
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Thanks for making the change. I'll find a time to run the benchmark but I think it will resolve the gc issue I mentioned previously.
However using two separate async task queues may need more consideration.
Re: e6a7563 It's not ideal to handle
The benefit:
Another robustness sugggestion is to expose an option to limit the max write buffer size per connection, which prevents slow connection accumulate unbounded sending buffer. |
Further thought: I think it's important for My previous proposal has a flaw in that
With this change, the caller is aware of the error immediately when one of the two limits is reached. I am not sure how difficult to do the buf size check within Appologize if this makes the PR even more complicated. Hope you'll see that I am trying to make constructive suggestions to make |
Limiting queue size and write buffer may also make points in this case, but I still think that it's rational to introduce a new task queue with higher priority, sometimes we want to run tasks inside event-loops as soon as possible, we don't want them to be delayed by tasks of As for the special treatment to
No need to feel sorry for your thoughtful consideration, I actually appreciate it. I reckon that |
Would you spare some time to run your tests on this PR? |
Agreed that a priority task queue is necessary for certain admin ops. Rather than naming them Turns out that my test code relies on changes on my fork of gnet. It will take some time to merge this branch to my fork to run the test. From the code review I think the gc pause issue should be greatly aliviated. I'd suggest to merge this PR when you feel comfortable and I'll later merget it into my fork and do the test. |
Fixes #214
name: Pull request
about: Propose changes to the code
title: 'reduce GC pause frequency for Conn.AsyncWrite'
labels: ''
assignees: ''
1. Are you opening this pull request for bug-fixs, optimizations or new feature?
Optimizations
2. Please describe how these code changes achieve your intention.
Eliminate function literals and reuse structs with the help of
sync.Pool
3. Please link to the relevant issues (if any).
#214
4. Which documentation changes (if any) need to be made/updated because of this PR?
None
4. Checklist