Skip to content
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: move taskpool at endpoint layer #50

Merged
merged 3 commits into from
Nov 23, 2020

Conversation

watermelo
Copy link
Member

What this PR does:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@wongoo
Copy link

wongoo commented Nov 17, 2020

using go mod tidy to remove unused lib version in go.sum

server.go Outdated
@@ -22,6 +22,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
gxsync "github.com/dubbogo/gost/sync"

Choose a reason for hiding this comment

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

move out to 3rd import block.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@codecov-io
Copy link

codecov-io commented Nov 22, 2020

Codecov Report

Merging #50 (9ae631e) into master (bf36b5d) will decrease coverage by 0.21%.
The diff coverage is 12.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
- Coverage   66.07%   65.85%   -0.22%     
==========================================
  Files           8        8              
  Lines        1350     1356       +6     
==========================================
+ Hits          892      893       +1     
- Misses        365      370       +5     
  Partials       93       93              
Impacted Files Coverage Δ
client.go 67.41% <0.00%> (-0.31%) ⬇️
options.go 81.25% <0.00%> (-11.61%) ⬇️
session.go 65.15% <0.00%> (ø)
server.go 65.86% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf36b5d...9ae631e. Read the comment docs.

@watermelo
Copy link
Member Author

using go mod tidy to remove unused lib version in go.sum

done

@AlexStocks AlexStocks merged commit bc65ed0 into apache:master Nov 23, 2020
@AlexStocks
Copy link

AlexStocks commented Nov 29, 2020

image
流程:
1 退出;
2 如果 p.work 没有任务,就会阻塞,执行 t;
3 再次尝试 step2
4 如果设定的task 数目没有超过, 则新启动一个 goroutine 执行 worker;
5 所有 work gr 都在忙,自动启动一个临时的 gr
就是会有 len(p.sem) 个常驻 gr 构成一个 gr pool,gr pool 没有空闲就启动临时 gr。再也没有阻塞的问题了。

而且以往每个session一个gr pool,现在这个 gr pool 变成全局的了。

所以我建议 gr num也就是 sem len,设置长度是 GOMAXPROC * 200。

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.

None yet

5 participants