Skip to content

Commit 72d3706

Browse files
alexjbaclaude
andcommitted
perf(backend): raise mobile Go memory limit 150MB -> 1GB — undersized limit forced permanent GC thrash (#21470-hf)
The 150MB soft memory limit sat ~3x below the service process's measured working set (350-620MB while syncing a large community), forcing the Go GC into permanent maximum-aggression mode. A/B on a Samsung S21FE running the identical 9-day community sync (~1.7GB ingested, all other #21470 fixes in place): with the 150MB limit the GC consumed 61% of service CPU and the process ran at 150-390% CPU; with the limit lifted the same walk ran at 46-127% CPU and GC left the profile's top consumers entirely, at a peak RSS of 621MB (bounded independently by the hash-first ingest backpressure). 1GB retains an OOM guard well above the working set without starving the GC. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 8d13821) (cherry picked from commit ad0e2350b27dbf2dca2c756388295f81e45dc62b)
1 parent 1b8531a commit 72d3706

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/backend/geth_backend.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,15 @@ func NewStatusBackend(logger *zap.Logger) *StatusBackend {
125125
zap.String("IpfsGatewayURL", gocommon.IpfsGatewayURL))
126126

127127
if gocommon.IsMobilePlatform() {
128-
debug.SetMemoryLimit(1024 * 1024 * 150) // 150MB
128+
// #21470: the previous 150MB soft limit sat ~3x below the measured
129+
// working set (350-620MB while syncing a large community), which forces
130+
// the Go GC into permanent maximum-aggression mode. Measured on a
131+
// Samsung S21FE (identical 9-day community sync, ~1.7GB ingested):
132+
// with 150MB the GC was 61% of service CPU and the process ran at
133+
// 150-390% CPU; with the limit lifted the same walk ran at 46-127%
134+
// CPU with GC no longer in the profile's top consumers. 1GB keeps an
135+
// OOM guard well above the working set without starving the GC.
136+
debug.SetMemoryLimit(1024 * 1024 * 1024) // 1GB
129137
}
130138

131139
return backend

0 commit comments

Comments
 (0)