cockroachdb / cockroachdb/pebble
improve readahead logic, stop using FADV_SEQUENTIAL
- Dominant language
- Go
- Stars
- 6k
- Forks
- 584
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 5
Description
We currently support these readahead modes:
```go
// SysReadahead enables the use of SYS_READAHEAD call to prefetch data.
// The prefetch window grows dynamically as consecutive writes are detected.
SysReadahead
// FadviseSequential enables the use of FADV_SEQUENTIAL. For informed
// read-ahead, FADV_SEQUENTIAL is used from the beginning. For speculative
// read-ahead, SYS_READAHEAD is first used until the window reaches the
// maximum size, then we switch to FADV_SEQUENTIAL.
FadviseSequential
```
The SysReadahead mode has two deficiencies:
- it doesn't support starting with (and keeping) maximum prefetch window in the informed case
- we only prefetch at the current offset, when we read right outside of the last prefetch; this incurs a "hiccup" at each prefetch boundary; we should instead always have a prefetched window leading the current read.
I suspect that once we fix these deficiencies, the use of FADV_SEQUENTIAL will not yield much benefit and can be removed. This method adds complexity and has the disadvantage of having to reopen the file.
Jira issue: PEBBLE-1318
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.