estimate: less ram for indexing (#8911)

This commit is contained in:
Alex Sharov 2023-12-06 15:20:28 +07:00 committed by GitHub
parent 96bb5ddb81
commit e11e374f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,9 +22,15 @@ func (r estimatedRamPerWorker) WorkersHalf() int { return cmp.Max(1, r.Worker
func (r estimatedRamPerWorker) WorkersQuarter() int { return cmp.Max(1, r.Workers()/4) }
const (
IndexSnapshot = estimatedRamPerWorker(3 * datasize.GB) //elias-fano index building is single-threaded
CompressSnapshot = estimatedRamPerWorker(1 * datasize.GB) //1-file-compression is multi-threaded
ReconstituteState = estimatedRamPerWorker(512 * datasize.MB) //state-reconstitution is multi-threaded
//elias-fano index building is single-threaded
// when set it to 3GB - observed OOM-kil at server with 128Gb ram and 32CPU
IndexSnapshot = estimatedRamPerWorker(4 * datasize.GB)
//1-file-compression is multi-threaded
CompressSnapshot = estimatedRamPerWorker(1 * datasize.GB)
//state-reconstitution is multi-threaded
ReconstituteState = estimatedRamPerWorker(512 * datasize.MB)
)
// AlmostAllCPUs - return all-but-one cpus. Leaving 1 cpu for "work producer", also cloud-providers do recommend leave 1 CPU for their IO software