mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
Merge pull request #18211 from karalabe/drop-fd-limit
cmd/utils: max out the OS file allowance, don't cap to 2K
This commit is contained in:
commit
d2328b604a
@ -824,17 +824,12 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
|
|||||||
// makeDatabaseHandles raises out the number of allowed file handles per process
|
// makeDatabaseHandles raises out the number of allowed file handles per process
|
||||||
// for Geth and returns half of the allowance to assign to the database.
|
// for Geth and returns half of the allowance to assign to the database.
|
||||||
func makeDatabaseHandles() int {
|
func makeDatabaseHandles() int {
|
||||||
limit, err := fdlimit.Current()
|
limit, err := fdlimit.Maximum()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Failed to retrieve file descriptor allowance: %v", err)
|
Fatalf("Failed to retrieve file descriptor allowance: %v", err)
|
||||||
}
|
}
|
||||||
if limit < 2048 {
|
if err := fdlimit.Raise(uint64(limit)); err != nil {
|
||||||
if err := fdlimit.Raise(2048); err != nil {
|
Fatalf("Failed to raise file descriptor allowance: %v", err)
|
||||||
Fatalf("Failed to raise file descriptor allowance: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if limit > 2048 { // cap database file descriptors even if more is available
|
|
||||||
limit = 2048
|
|
||||||
}
|
}
|
||||||
return limit / 2 // Leave half for networking and other stuff
|
return limit / 2 // Leave half for networking and other stuff
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user