duongkame commented on PR #990:
URL: https://github.com/apache/ratis/pull/990#issuecomment-1867157686

   > This is not necessarily true -- when the log can be fast but the 
`StateMachine` is slow, `evictCache` can happen before `processClientRequest`.
   
   That's the reason why we need to keep the buffer sorted by log index, so if 
some entry is missed because `evictCache` happens before 
`processClientRequest`, it'll be caught by the next `evictCache`.  All buffers 
ready to release can be easily addressed from a log index. This approach is way 
cleaner than managing each buffer separately. 
   
   Also, `evictCache` only happens when [the cache capacity is about to be 
filled](https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogCache.java#L445-L454).
 There may be (very) few occurences of  `evictCache` before 
`processClientRequest` returns, but not the majority. 
   
   Plus, as discussed as per RATIS-1979, in the case of 
stateMachineCachingEnabled, we may consider releasing zero-copy buffers much 
earlier than cache evict. The ability to release all zero copy buffers up to a 
certain log index seems to be crucial. 
   


-- 
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]

Reply via email to