You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "funky-eyes (via GitHub)" <gi...@apache.org> on 2024/08/23 07:09:45 UTC

[I] optimize seata-client TM&RM netty eventloop [incubator-seata]

funky-eyes opened a new issue, #6774:
URL: https://github.com/apache/incubator-seata/issues/6774

   <!-- Please do not use this issue template to report security vulnerabilities but refer to our [security policy](https://github.com/seata/seata/security/policy). -->
   
   ## Why you need it?
   构建多个eventloopgroup时,会构建对应的平台线程,会增加线程切换的开销,而TM和RM都属于client,如果一个应用恰好是TM和RM正好可以降低额外的线程数。
   When building multiple EventLoopGroups, corresponding platform threads are created, which increases the overhead of context switching. Since both TM and RM are clients, if an application happens to be both TM and RM, it can reduce the number of additional threads.
   
   ## How it could be?
   A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.
   
   
   ## Other related information
   Add any other context or screenshots about the feature request here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2635594140

   @funky-eyes 
   
   If there are no updates, i'd like to take this issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2664723681

   > > I believe the core module is an underlying implementation, and GlobalTransactionScanner falls within the scope of the business layer. Therefore, EventLoopGroup should not be set from GlobalTransactionScanner.
   > 
   > Could you provide a bit more detailed explanation?
   > 
   > Additionally, I looked into the classes that use `EventLoopGroup` and found that `NettyServerBootstrap` and `NettyClientBootstrap` are located in the core module. Based on this, I believe that the relevant code is related to the core module.
   > 
   > Could you confirm if my understanding is correct?
   > 
   > > I haven’t fully grasped their exact roles yet.
   
   Yes, for example, in NettyClientBootstrap, we can build a shared eventLoop. When the configuration for the shared eventLoop is set to true, it will create and use the shared eventLoop. If it is set to false, the original logic will be maintained.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2665079020

   > > Yes, for example, in NettyClientBootstrap, we can build a shared eventLoop. When the configuration for the shared eventLoop is set to true, it will create and use the shared eventLoop. If it is set to false, the original logic will be maintained.
   > 
   > I heard that there’s a discussion about this comment on DingTalk. Should i wait for that conversation to finish before starting the work?
   
   I believe that issue does not affect the progress of the current issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2635756187

   > > [@funky-eyes](https://github.com/funky-eyes)
   > > If there are no updates, i'd like to take this issue.
   > 
   > Of course,I have assigned it to you and look forward to your PR
   
   Thank you :)
   Since we are in a similar time zone, it makes communication easier. 😂


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2676706690

   @funky-eyes 
   
   I have created a draft PR with a question.  
   
   > Yes, for example, in NettyClientBootstrap, we can build a shared eventLoop. When the configuration for the shared eventLoop is set to true, it will create and use the shared eventLoop. If it is set to false, the original logic will be maintained.
   
   As mentioned in the comments, I have implemented `NettyClientBootstrap` to create a shared `eventLoop` based on the configuration.  
   
   In this case, I am wondering if the shared `eventLoop` should be `static`.  
   
   If it is `static`, it will be shared across classes, allowing multiple instances of `NettyClientBootstrap` to use the same `eventLoop`. However, if it is not shared, creating a new `eventLoop` will also change the `eventLoop` of previously created `NettyClientBootstrap` instances.
   
   ---
   
   In the test below, if `eventLoop` is `static`, it remains the `same` even when `getEnableClientSharedEventLoop`'s return value is `false`.
   
   ```
       @Test
       void testSharedEventLoopGroupDisabled() {
           when(nettyClientConfig.getEnableClientSharedEventLoop()).thenReturn(false);
           NettyClientBootstrap tmBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.TMROLE);
           NettyClientBootstrap rmBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.RMROLE);
   
           EventLoopGroup tmSharedEventLoopGroup = getSharedEventLoopGroup(tmBootstrap);
           EventLoopGroup rmSharedEventLoopGroup = getSharedEventLoopGroup(rmBootstrap);
           Assertions.assertNotSame(tmSharedEventLoopGroup, rmSharedEventLoopGroup, "EventLoopGroup should not be shared");
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes closed issue #6774: optimize seata-client TM&RM netty eventloop
URL: https://github.com/apache/incubator-seata/issues/6774


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2660902203

   I believe the core module is an underlying implementation, and GlobalTransactionScanner falls within the scope of the business layer. Therefore, EventLoopGroup should not be set from GlobalTransactionScanner.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2658150087

   @funky-eyes 
   I’m leaving this comment as I had a question while designing this issue.
   
   I understand that the core idea of this issue is to ensure that both `TM` and `RM` clients share the same `EventLoopGroup`.
   
   With that in mind, I thought it would be best to create an `EventLoopGroup` in `GlobalTransactionScanner` and pass it to both `TMClient` and `RMClient` during their initialization via the `initClient` method.
   - https://github.com/apache/incubator-seata/blob/6b25b21b6de91c9a9c47d7373943cdf2549c55af/spring/src/main/java/org/apache/seata/spring/annotation/GlobalTransactionScanner.java#L233
   
   However, I couldn’t find any part of the `TMClient` and `RMClient` `init` or the `getInstance` method that directly handles `EventLoopGroup`.
   - https://github.com/apache/incubator-seata/blob/6b25b21b6de91c9a9c47d7373943cdf2549c55af/tm/src/main/java/org/apache/seata/tm/TMClient.java#L45
   - https://github.com/apache/incubator-seata/blob/6b25b21b6de91c9a9c47d7373943cdf2549c55af/rm/src/main/java/org/apache/seata/rm/RMClient.java#L33
   
   Could you confirm whether this logic is missing, or if there’s an alternative approach for sharing `EventLoopGroup`?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2662434959

   > I believe the core module is an underlying implementation, and GlobalTransactionScanner falls within the scope of the business layer. Therefore, EventLoopGroup should not be set from GlobalTransactionScanner.
   
   Could you provide a bit more detailed explanation?
   
   Additionally, I looked into the classes that use `EventLoopGroup` and found that `NettyServerBootstrap` and `NettyClientBootstrap` are located in the core module. Based on this, I believe that the relevant code is related to the core module. 
   
   Could you confirm if my understanding is correct?
   > I haven’t fully grasped their exact roles yet. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2310320653

   > Hi @funky-eyes, can i pick up this ticket?
   
   Of course, looking forward to your PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "zzzk1 (via GitHub)" <gi...@apache.org>.
zzzk1 commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2308303331

   Hi @funky-eyes, can i pick up this ticket?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2664976149

   > Yes, for example, in NettyClientBootstrap, we can build a shared eventLoop. When the configuration for the shared eventLoop is set to true, it will create and use the shared eventLoop. If it is set to false, the original logic will be maintained.
   
   I heard that there’s a discussion about this comment on DingTalk. 
   Should i wait for that conversation to finish before starting the work?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] optimize seata-client TM&RM netty eventloop [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6774:
URL: https://github.com/apache/incubator-seata/issues/6774#issuecomment-2635753448

   > [@funky-eyes](https://github.com/funky-eyes)
   > 
   > If there are no updates, i'd like to take this issue.
   
   Of course,I have assigned it to you and look forward to your PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org