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

optimize: asynchronous tasks handle global transactions in parallel #4400

Merged
merged 5 commits into from
Feb 24, 2022

Conversation

funky-eyes
Copy link
Contributor

@funky-eyes funky-eyes commented Feb 22, 2022

  • I have registered the PR changes.

Ⅰ. 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

@funky-eyes funky-eyes added this to the 1.5.0 milestone Feb 22, 2022
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2022

Codecov Report

Merging #4400 (d6d2bb2) into develop (d4b265f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
...in/java/io/seata/server/session/SessionHelper.java 72.41% <100.00%> (ø)
...very/registry/zk/ZookeeperRegisterServiceImpl.java 61.02% <0.00%> (-0.74%) ⬇️
...torage/file/store/FileTransactionStoreManager.java 57.41% <0.00%> (+0.64%) ⬆️
...erver/storage/file/session/FileSessionManager.java 52.55% <0.00%> (+0.72%) ⬆️

Copy link
Contributor

@wangliang181230 wangliang181230 left a comment

Choose a reason for hiding this comment

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

LGTM

@wangliang181230
Copy link
Contributor

是否可以改造成线程池,并且可配置化会更好?

@funky-eyes
Copy link
Contributor Author

是否可以改造成线程池,并且可配置化会更好?

有道理,目前这样其实还是有点问题,因为这里的核心数其实是机器的核心数,导致业务线程池的默认核心数是50,大流量进来可能是50:4的差距,导致只要写大于删(二阶段补偿,或者异步提交)还是容易出现file/raft模式下内存被打满的情况
目前有以下想法:
1.异步补偿任务的线程池复用业务线程池,这样虽然会影响tc吞吐,但是起码tc自身得到保障了
2.独立一个与业务线程池同等大小的线程池处理,但是这样可能造成cpu load飙高
3.限流(2.0.0会合并进来),限流就可以减缓begin和registry的速度,那么内存占用也可以得到一定的缓解

Copy link
Contributor

@lightClouds917 lightClouds917 left a comment

Choose a reason for hiding this comment

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

LGTM

@lightClouds917 lightClouds917 merged commit 4622746 into apache:develop Feb 24, 2022
@@ -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 -> {
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

seata AT模式 file存储数据 持续高并发压力下导致频繁full gc
5 participants