Tune Go garbage collection on AWS Graviton
Introduction
Choose an AWS Graviton instance for Go GC benchmarking
Install Go and Benchstat on an AWS Graviton-based Amazon EC2 instance
Create a Go garbage collection benchmark
Run the benchmark with default Go garbage collection settings
Interpret the default garbage collection benchmark results
Experiment with garbage collection optimization
Next Steps
Tune Go garbage collection on AWS Graviton
Introduction
Choose an AWS Graviton instance for Go GC benchmarking
Install Go and Benchstat on an AWS Graviton-based Amazon EC2 instance
Create a Go garbage collection benchmark
Run the benchmark with default Go garbage collection settings
Interpret the default garbage collection benchmark results
Experiment with garbage collection optimization
Next Steps
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Run
go version and check that it reports linux/arm64. Also run go env GOOS GOARCH and confirm GOARCH is arm64.Confirm that
GOGC, GOMEMLIMIT, GODEBUG, and GOMAXPROCS aren’t set. Use env | grep -E '^(GOGC|GOMEMLIMIT|GODEBUG|GOMAXPROCS)=' || true and unset any variables that appear.You should have a runtime snapshot (Go version,
GOOS/GOARCH, CPU count, and memory) and raw benchmark output in default_gc_benchmark.txt. Run benchstat default_gc_benchmark.txt next to create the summary used to compare and interpret the baseline metrics.ns/op shows time per operation (lower is faster), B/op shows bytes allocated per operation, and allocs/op shows the number of allocations per operation—lower values generally reduce GC pressure. gc/op indicates how often GC cycles occur per operation. A lower gc/op means GC runs less frequently for the same work.Leave
GOGC, GOMEMLIMIT, GODEBUG, and GOMAXPROCS unset and run the benchmark using the profiling commands. The run writes CPU and heap profiles alongside the benchmark results while preserving default GC behavior.