cockroach
cockroach copied to clipboard
cli,server: increase `GOGC` by default to 300%, add CLI flag
Closes #115164.
This commit introduces a new --go-gc-percent flag to CLI start command which controls the garbage collection target percentage on the Go runtime. The default value for the flag if neither the --go-gc-percent flag nor the GOGC env var is set is 300%.
To avoid introducing new OOMs, we only switch to this new default (up from 100%) if a soft memory limit is set, either manually or automatically.
Release note (cli change): A new flag --go-gc-percent is introduced to start command. It controls the garbage collection target percentage on the Go runtime, mirroring the existing GOGC environment variable. A garbage collection is triggered when the ratio of freshly allocated data to live data remaining after the previous collection reaches this percentage. If left unspecified, defaults to 300%.
NOTE: leaving this in a draft state until I can run some benchmarks on this to confirm that it is a net positive.
TFTR!
bors r+