mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
estimate: at-lest 1 worker (#8859)
This commit is contained in:
parent
2e0f9b0411
commit
473e0414ef
@ -14,7 +14,8 @@ type estimatedRamPerWorker datasize.ByteSize
|
|||||||
func (r estimatedRamPerWorker) Workers() int {
|
func (r estimatedRamPerWorker) Workers() int {
|
||||||
// 50% of TotalMemory. Better don't count on 100% because OOM Killer may have aggressive defaults and other software may need RAM
|
// 50% of TotalMemory. Better don't count on 100% because OOM Killer may have aggressive defaults and other software may need RAM
|
||||||
maxWorkersForGivenMemory := (mmap.TotalMemory() / 2) / uint64(r)
|
maxWorkersForGivenMemory := (mmap.TotalMemory() / 2) / uint64(r)
|
||||||
return cmp.Min(AlmostAllCPUs(), int(maxWorkersForGivenMemory))
|
res := cmp.Min(AlmostAllCPUs(), int(maxWorkersForGivenMemory))
|
||||||
|
return cmp.Max(1, res) // must have at-least 1 worker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r estimatedRamPerWorker) WorkersHalf() int { return cmp.Max(1, r.Workers()/2) }
|
func (r estimatedRamPerWorker) WorkersHalf() int { return cmp.Max(1, r.Workers()/2) }
|
||||||
|
Loading…
Reference in New Issue
Block a user