cockroachdb / cockroachdb/pebble

improve readahead logic, stop using FADV_SEQUENTIAL

Open
#5,685 2 comments 0 reactions 1 assignee Claimed by @RaduBerinde View on GitHub
A-storage T-storage
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.