lib/bytesutil/internstring.go: increase the limit on the maximum string lengths, which can be interned

The limit has been increased from 300 bytes to 500 bytes according to the collected production stats.
This allows reducing CPU usage without significant increase of RAM usage in most practical cases.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3692
This commit is contained in:
Aliaksandr Valialkin 2023-01-31 10:55:31 -08:00
parent 1cbdcd391c
commit ac8bc77688
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -9,7 +9,7 @@ import (
"github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime" "github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime"
) )
var internStringMaxLen = flag.Int("internStringMaxLen", 300, "The maximum length for strings to intern. Lower limit may save memory at the cost of higher CPU usage. "+ var internStringMaxLen = flag.Int("internStringMaxLen", 500, "The maximum length for strings to intern. Lower limit may save memory at the cost of higher CPU usage. "+
"See https://en.wikipedia.org/wiki/String_interning") "See https://en.wikipedia.org/wiki/String_interning")
// InternBytes interns b as a string // InternBytes interns b as a string