Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloader: docs on MMAP for data-files r/w and experiments with bufio #10074

Merged
merged 4 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions erigon-lib/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2568,7 +2568,18 @@ func openClient(ctx context.Context, dbDir, snapDir string, cfg *torrent.ClientC
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("torrentcfg.NewMdbxPieceCompletion: %w", err)
}

//Reasons why using MMAP instead of files-API:
// - i see "10K threads exchaused" error earlier (on `--torrent.download.slots=500` and `pd-ssd`)
// - "sig-bus" at disk-full - may happen anyway, because DB is mmap
// - MMAP - means less GC pressure, more zero-copy
// - MMAP files are pre-allocated - which is not cool, but: 1. we can live with it 2. maybe can just resize MMAP in future
// See also: https://github.com/ledgerwatch/erigon/pull/10074
m = storage.NewMMapWithCompletion(snapDir, c)
//m = storage.NewFileOpts(storage.NewFileClientOpts{
// ClientBaseDir: snapDir,
// PieceCompletion: c,
//})
cfg.DefaultStorage = m

torrentClient, err = torrent.NewClient(cfg)
Expand Down
Loading