[ 
https://issues.apache.org/jira/browse/RATIS-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17624199#comment-17624199
 ] 

Song Ziyang commented on RATIS-1730:
------------------------------------

[~szetszwo] Thanks for providing the patch! I applied the patch to branch-2 and 
tested again. This time I see a 3x drop on checkAndEvictCache execution time, 
taking up roughly 15% of the total follower AppendEntriesAsync execution time. 
See the new screen-shot. I think the result is good enough for now. Can we also 
include this patch to the 2.4.1?

 

Still, checkAndEvict cache consumes 15% execution time (50ms), and I think 
there's a lot of room for further optimizations. I'll come back to this issue 
in the future.

 

 

> Use Daemon thread to evict RaftLogCache
> ---------------------------------------
>
>                 Key: RATIS-1730
>                 URL: https://issues.apache.org/jira/browse/RATIS-1730
>             Project: Ratis
>          Issue Type: Improvement
>          Components: server
>            Reporter: Song Ziyang
>            Assignee: Song Ziyang
>            Priority: Major
>         Attachments: RATIS-1730.patch, image-20221026020057385.png, 
> new_result.png
>
>
> Using JProfiler, I found almost 50% of AppendEntriesAsync execution time is 
> spent on checkAndEvictCache, see the attached pic. There's also a TODO[1] 
> suggesting to use a daemon thread to perform checkAndEvictCache. 
> The time are mainly spent on getTotalCacheSize() and countCached(). These two 
> methods will visit every segments. When there are lots of closed segments, 
> visiting them all is indeed a very consuming operation, not to mention that 
> they are performed on every appendEntriesAsync.
> [1][https://github.com/apache/ratis/blob/b8117f41481f5f5861566a68bb1ea4dc7c60320c/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java#L402]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to