ici/sdr: optimize syscalls for file backed sdr - #107
Open
zebastian wants to merge 2 commits into
Open
Conversation
Every file-backed access in the SDR dataspace and transaction log used a separate lseek followed by read/write. The lseek syscall dominated the file-backed path, since scattered field updates seek on every call, and it left a window in which the file offset and the I/O could race. Convert all of them to single positioned pread/pwrite calls: - _sdrput dataspace write and _sdrfetch dataspace read (hot path) - _sdrput reversible undo-capture read of the pre-image - readFromLog log-entry read - reverseTransaction dataspace restore writes (rollback path) Reduction of syscalls yields better performance: 200k 64-byte writes, 16 per txn yield ~20-30% more throughput.
A reversible write logged its undo record in two steps -- a control header (offset, length) then the affected bytes' pre-image -- which for the persistent file log meant two write() syscalls per field updated. Replace writeToLog with writevToLog, which appends the whole entry from an iovec: for the file log a single positioned pwritev gathers the header and pre-image directly from their existing locations (no intermediate copy, one syscall instead of two).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This yields ~20-30 % more throughput for file backed sdr