You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/09/03 02:45:18 UTC

[GitHub] [ratis] JacksonYao287 opened a new pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

JacksonYao287 opened a new pull request #497:
URL: https://github.com/apache/ratis/pull/497


   ## What changes were proposed in this pull request?
   
   since we have [RATIS-1399](https://github.com/apache/ratis/pull/496), each `notify` of all the log senders will be executed in parallel , default using ForkJoinPool ,which has a fixed num of threads in thread pool (default the same as the num of cpu core)
   
   in GrpcLogAppender.java,  `synchronized` is used for two purposes:
   
   1 protect `wait()`
   
   2 protect variables like  `pendingRequests`, `pending` , etc.
   
   this patch add a separate RWLock for the second case , and keep `synchronized` only for wait and notify, thus any slow IO option will not block notify.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/RATIS-1400
   
   ## How was this patch tested?
   
   unit test
   


-- 
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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] szetszwo commented on a change in pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #497:
URL: https://github.com/apache/ratis/pull/497#discussion_r701626836



##########
File path: ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
##########
@@ -66,6 +68,8 @@
 
   private final GrpcServerMetrics grpcServerMetrics;
 
+  private final ReadWriteLock lock;

Review comment:
       Let's use AutoCloseableReadWriteLock instead of ReentrantReadWriteLock.  Then, we can use try-with-resource to acquire and release the lock.




-- 
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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] JacksonYao287 commented on a change in pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on a change in pull request #497:
URL: https://github.com/apache/ratis/pull/497#discussion_r701689363



##########
File path: ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
##########
@@ -66,6 +68,8 @@
 
   private final GrpcServerMetrics grpcServerMetrics;
 
+  private final ReadWriteLock lock;

Review comment:
       make sense, thanks @szetszwo for the reivew,  i will do it in a new commit




-- 
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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] JacksonYao287 commented on pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on pull request #497:
URL: https://github.com/apache/ratis/pull/497#issuecomment-912211175


   @szetszwo PTAL!


-- 
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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] szetszwo merged pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
szetszwo merged pull request #497:
URL: https://github.com/apache/ratis/pull/497


   


-- 
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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] JacksonYao287 commented on pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on pull request #497:
URL: https://github.com/apache/ratis/pull/497#issuecomment-913265711


   thanks @szetszwo for the review  and @guihecheng for the great 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: issues-unsubscribe@ratis.apache.org

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



[GitHub] [ratis] guihecheng commented on pull request #497: RATIS-1400. add a separate RWlock for GrpcLogAppender

Posted by GitBox <gi...@apache.org>.
guihecheng commented on pull request #497:
URL: https://github.com/apache/ratis/pull/497#issuecomment-912421109


   I think it is great to have a separate lock for appender works, for wait() we have to use synchronized.


-- 
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: issues-unsubscribe@ratis.apache.org

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