Optimize FileChannelJournalSegmentReader channel use 62/110562/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Mar 2024 09:47:49 +0000 (10:47 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 11 Mar 2024 12:51:11 +0000 (12:51 +0000)
commit2d9ad8ba93602b8b90b29a923a6d961b9cc42011
tree5aecf0b9d6d5daa8578d478d1f2c52116b83d26d
parente45cb9c496fc4a0a9db69b419b8aa24d21f6e30a
Optimize FileChannelJournalSegmentReader channel use

We use FileChannel to maintain our position for a particular reader,
which is a naive implementation.

Since FileChannel's position is tied to the underlying file descriptor,
each such manipulation involves locking and system calls.

Switch to maintaining the position ourselves and using
FileChannel.read(buffer, position), improving performance.

JIRA: CONTROLLER-2094
Change-Id: I7f462f3fd8aa9bc47c16201dd32faeb2a7c18a32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
atomix-storage/src/main/java/io/atomix/storage/journal/FileChannelJournalSegmentReader.java