921205zhangcheng commented on PR #13857:
URL: https://github.com/apache/dubbo/pull/13857#issuecomment-1987565191

   JNI is sometimes involved in low-level network operations for performance 
optimization purposes but it does not directly cause thread pinning. Netty's 
event loops are designed to handle I/O events and tasks efficiently, using 
non-blocking I/O and event-driven programming model to minimize thread blocking.
   The "pinning" concept you might be referring to could mean whether a thread 
stays dedicated to specific tasks or gets stuck handling certain operations. In 
Netty, each event loop thread handles I/O events for its own set of channels 
and does not generally get blocked on these operations if they are implemented 
correctly as non-blocking (as most Netty components are).
   
   
   However, if there is a bug or misuse of Netty where a JNI call is made in a 
way that causes a thread to block indefinitely, then yes, it could effectively 
"pin" that thread. But this would be an implementation issue rather than a 
characteristic of Netty itself.
   
   
   The createBossGroup method returns an event loop thread group. The bossGroup 
is responsible for maintaining the long link between the client and server. It 
usually does not require too many threads because of the internal multiplexing 
mechanism and I have modified the thread group to be a virtual thread group Can 
NettyEventLoopFactory. EventLoopGroup view the virtual thread has not need to 
specify the initialize the number of threads when a thread pool Because virtual 
thread context switching is lightweight Completely controlled by the JVM 
initialize a thread takes less memory, I have integrated virtual threads for 
jdk21 into my rpc framework and have used them online
   
   
   
   
   
   ---Original---
   From: "Albumen ***@***.***>
   Date: Mon, Mar 11, 2024 10:16 AM
   To: ***@***.***>;
   Cc: ***@***.******@***.***>;
   Subject: Re: [apache/dubbo] Netty Loom Adapt (PR #13857)
   
   
   
   
    
   @AlbumenJ requested changes on this pull request.
    
    
   In 
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java:
    > @@ -153,13 +153,17 @@ private boolean isSupportMetrics() {      }      
  protected EventLoopGroup createBossGroup() { -        return 
NettyEventLoopFactory.eventLoopGroup(1, EVENT_LOOP_BOSS_POOL_NAME); +        
return NettyEventLoopFactory.eventLoopGroup(true,1, EVENT_LOOP_BOSS_POOL_NAME); 
 
   I am concerned about whether netty will pin the thread due to jni.
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you authored the thread.Message ID: 
***@***.***>


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to