cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

cli,server: increase `GOGC` by default to 300%, add CLI flag

Open nvb opened this issue 1 year ago • 1 comments

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.

nvb avatar Feb 24 '24 00:02 nvb

This change is Reviewable

cockroach-teamcity avatar Feb 24 '24 00:02 cockroach-teamcity

TFTR!

bors r+

nvb avatar Mar 13 '24 21:03 nvb