diff --git a/cmd/diag/downloader/downloader.go b/cmd/diag/downloader/diag_downloader.go similarity index 100% rename from cmd/diag/downloader/downloader.go rename to cmd/diag/downloader/diag_downloader.go diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index b70af3c1304..cd5c8f80d2b 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -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)