Is there an existing issue for this?
Current Behavior
After upgrading Kong Ingress Controller from v3.3 to v3.5.11, we observed a critical memory regression. The total RAM consumption (sys_bytes) of the leader KIC pod increased by approximately 50% (from 1.84 GB to 2.94 GB).
I used the /metrics KIC endpoint by 10255 port to collect Go runtime metrics. Analysis of the data reveals two root causes:
-
The Garbage Collector in v3.5.11 practically stopped releasing idle memory back to the OS. By comparing go_memstats_heap_released_bytes to go_memstats_heap_idle_bytes, only 0.6% of the idle heap was released in v3.5.11, compared to 50% in v3.3.
-
The memory footprint per cached object has increased by ~28% (from ~215 bytes/object in v3.3 to ~276 bytes/object in v3.5.11) - go_memstats_heap_alloc_bytes / go_memstats_heap_objects (however, I am not sure that it is correct to compare this way)
Expected Behavior
Memory consumption and GC behavior should be comparable to v3.3. The Go runtime should actively release idle heap memory back to the OS. The internal data structures representing Kubernetes objects should not significantly increase in size.
Steps To Reproduce
KIC v3.3 - Stable baseline
go_memstats_sys_bytes: 1.84 GB
go_memstats_heap_alloc_bytes: 1.19 GB
go_memstats_heap_objects: 5,542,030
go_memstats_heap_idle_bytes: 552 MB
go_memstats_heap_released_bytes: 283 MB (51% of idle memory successfully returned to OS)
go_version: go1.23.0
KIC v3.5 - Memory regression
go_memstats_sys_bytes: 2.94 GB
go_memstats_heap_alloc_bytes: 1.84 GB
go_memstats_heap_objects: 6,654,745
go_memstats_heap_idle_bytes: 978 MB
go_memstats_heap_released_bytes: 6 MB (Only 0.6% of idle memory returned to OS)
go_version: go1.23.0
Kong Ingress Controller version
KIC Version: 3.5.11 (upgraded from 3.3.0)
Kong Gateway Version: 3.9, 3.8 (we have checked both)
DB-less mode
Kubernetes version
Anything else?
No response
Is there an existing issue for this?
Current Behavior
After upgrading Kong Ingress Controller from v3.3 to v3.5.11, we observed a critical memory regression. The total RAM consumption (sys_bytes) of the leader KIC pod increased by approximately 50% (from 1.84 GB to 2.94 GB).
I used the /metrics KIC endpoint by 10255 port to collect Go runtime metrics. Analysis of the data reveals two root causes:
The Garbage Collector in v3.5.11 practically stopped releasing idle memory back to the OS. By comparing go_memstats_heap_released_bytes to go_memstats_heap_idle_bytes, only 0.6% of the idle heap was released in v3.5.11, compared to 50% in v3.3.
The memory footprint per cached object has increased by ~28% (from ~215 bytes/object in v3.3 to ~276 bytes/object in v3.5.11) - go_memstats_heap_alloc_bytes / go_memstats_heap_objects (however, I am not sure that it is correct to compare this way)
Expected Behavior
Memory consumption and GC behavior should be comparable to v3.3. The Go runtime should actively release idle heap memory back to the OS. The internal data structures representing Kubernetes objects should not significantly increase in size.
Steps To Reproduce
Kong Ingress Controller version
Kubernetes version
Anything else?
No response