lib/cgroup: set GOGC to 50 by default if it isn't set

This should reduce memory usage for typical VictoriaMetrics workloads by up to 50%
This commit is contained in:
Aliaksandr Valialkin
2021-07-05 12:31:26 +03:00
parent bd6b8f7e31
commit 54b9e1d3cb
3 changed files with 34 additions and 3 deletions

View File

@@ -51,6 +51,7 @@ func writePrometheusMetrics(w io.Writer) {
fmt.Fprintf(w, "vm_allowed_memory_bytes %d\n", memory.Allowed())
fmt.Fprintf(w, "vm_available_memory_bytes %d\n", memory.Allowed()+memory.Remaining())
fmt.Fprintf(w, "vm_available_cpu_cores %d\n", cgroup.AvailableCPUs())
fmt.Fprintf(w, "vm_gogc %d\n", cgroup.GetGOGC())
// Export start time and uptime in seconds
fmt.Fprintf(w, "vm_app_start_timestamp %d\n", startTime.Unix())