zhixinwen commented on issue #3097:
URL: https://github.com/apache/kvrocks/issues/3097#issuecomment-3153004778

   I think the issue is read callback 
(https://github.com/apache/kvrocks/blob/unstable/src/cluster/replication.cc#L89)
 is not disabled when `FeedSlaveThread` is stopped.
   
   I find another issue when checking the code. The connection used in 
`FeedSlaveThread` is switched to blocking mode 
(https://github.com/apache/kvrocks/blob/52ca732b3c55a9d26c929e0d4b219e1f896a99e0/src/commands/cmd_replication.cc#L95).
 In theory, we should only use non-blocking socket in bufferevent. However, we 
are now essentially using a blocking socket  here: 
https://github.com/apache/kvrocks/blob/unstable/src/cluster/replication.cc#L89.
   
   I am not sure why it works (maybe it works but performance is not optimal?). 
To solve this, we have two options:
   1. Spawn a thread to read from the blocking thread. This would mean we may 
have to rewrite request tokenize logic in 
https://github.com/apache/kvrocks/blob/unstable/src/cluster/replication.cc#L128
   2.  change `FeedSlaveThread::loop()` to write callback and use libevent. 
This looks straightforward, but I am not sure why it was not used in the first 
place. 
   
   @git-hulk any suggestion?


-- 
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-unsubscr...@kvrocks.apache.org

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

Reply via email to