Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Netpoll
Commits
df95522d
Commit
df95522d
authored
3 years ago
by
wangzhuowei
Browse files
Options
Download
Email Patches
Plain Diff
Revert "feat: change default number of loops policy (#31)"
This reverts commit
a0c71452
.
parent
8319b9ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
poll_manager.go
+2
-14
poll_manager.go
with
2 additions
and
14 deletions
+2
-14
poll_manager.go
+
2
-
14
View file @
df95522d
...
...
@@ -31,22 +31,10 @@ func setLoadBalance(lb LoadBalance) error {
var
pollmanager
*
manager
func
init
()
{
var
loops
=
runtime
.
GOMAXPROCS
(
0
)
/
20
+
1
pollmanager
=
&
manager
{}
pollmanager
.
SetLoadBalance
(
RoundRobin
)
pollmanager
.
SetNumLoops
(
defaultNumLoops
())
}
func
defaultNumLoops
()
int
{
procs
:=
runtime
.
GOMAXPROCS
(
0
)
loops
:=
1
// Loops produce events that handlers consume,
// so the producer should be faster than consumer otherwise it will have a bottleneck.
// But there is no universal option that could be appropriate for any use cases,
// plz use `SetNumLoops` if you do know what you want.
if
procs
>
4
{
loops
=
procs
}
return
loops
pollmanager
.
SetNumLoops
(
loops
)
}
// LoadBalance is used to do load balancing among multiple pollers.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment