Tune Go garbage collection frequency by setting the GOGC environment variable to a percentage target.
Set the GOGC environment variable to a percentage value representing the target heap growth before the next garbage collection cycle.
export GOGC=200
A value of 200 means the garbage collector runs when the heap grows by 200% of the live data size, effectively delaying GC to reduce frequency but increasing memory usage.
GOGC is a setting that tells the Go program when to clean up unused memory. A higher number means the program waits longer to clean up, using more memory but running faster. A lower number means it cleans up often, using less memory but slowing down the program slightly.