-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
optimize: asynchronous tasks handle global transactions in parallel #4400
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4400 +/- ##
==========================================
Coverage 48.76% 48.77%
Complexity 3968 3968
==========================================
Files 733 733
Lines 25182 25182
Branches 3131 3132 +1
==========================================
+ Hits 12280 12282 +2
Misses 11599 11599
+ Partials 1303 1301 -2
|
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.
LGTM
是否可以改造成线程池,并且可配置化会更好? |
有道理,目前这样其实还是有点问题,因为这里的核心数其实是机器的核心数,导致业务线程池的默认核心数是50,大流量进来可能是50:4的差距,导致只要写大于删(二阶段补偿,或者异步提交)还是容易出现file/raft模式下内存被打满的情况 |
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.
LGTM
@@ -226,7 +226,7 @@ public static boolean isTimeoutGlobalStatus(GlobalStatus status) { | |||
* @since 1.5.0 | |||
*/ | |||
public static void forEach(Collection<GlobalSession> sessions, GlobalSessionHandler handler) { | |||
for (GlobalSession globalSession : sessions) { | |||
sessions.parallelStream().forEach(globalSession -> { |
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.
It is best to define separate fork/join thread pools.
Ⅰ. Describe what this PR did
在多个全局事务的二阶段处理应该保持并行,提高效率
在file/raft模式中也可以尽快的释放内存空间
未来应该再结合分支事务的并行下发,以降低网络io的阻塞占用耗时
Ⅱ. Does this pull request fix one issue?
fixes #4399
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews