[ 
https://issues.apache.org/jira/browse/RATIS-2390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika updated RATIS-2390:
-------------------------------
    Description: 
Currently, SegmentedRaftLog uses RaftLogBase.lock for all its operations even 
those that only operates on certain segments (e.g. purge, appends). It might be 
possible to reduce contention by having a unique lock per segment.

For example, operations that need to operate on segments only need to hold read 
lock on RaftLogBase.lock (in case top level attributes like commitIndex, 
snapshotIndex, etc are updated) and subsequently try to hold SegmentedRaftLog 
segment locks. We can implement something like writeLock(TermIndex fromIndex, 
TermIndex toIndex) and SegmentedRaftLog should only pick the segments locks for 
that range.

  was:
Currently, SegmentedRaftLog uses RaftLogBase.lock for all its operations even 
those that only operates on certain segments (e.g. purge, appends). It might be 
possible to reduce contention by having a unique lock per segment.

For example, operations that need to operate on segments only need to hold read 
lock on RaftLogBase.lock and subsequently try to hold SegmentedRaftLog segment 
locks. We can implement something like writeLock(TermIndex fromIndex, TermIndex 
toIndex) and SegmentedRaftLog should only pick the segments locks for that 
range.


> Granular segment lock for SegmentedRaftLog
> ------------------------------------------
>
>                 Key: RATIS-2390
>                 URL: https://issues.apache.org/jira/browse/RATIS-2390
>             Project: Ratis
>          Issue Type: Improvement
>          Components: RaftLog, server
>            Reporter: Ivan Andika
>            Priority: Major
>              Labels: performance
>
> Currently, SegmentedRaftLog uses RaftLogBase.lock for all its operations even 
> those that only operates on certain segments (e.g. purge, appends). It might 
> be possible to reduce contention by having a unique lock per segment.
> For example, operations that need to operate on segments only need to hold 
> read lock on RaftLogBase.lock (in case top level attributes like commitIndex, 
> snapshotIndex, etc are updated) and subsequently try to hold SegmentedRaftLog 
> segment locks. We can implement something like writeLock(TermIndex fromIndex, 
> TermIndex toIndex) and SegmentedRaftLog should only pick the segments locks 
> for that range.



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

Reply via email to