mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
docs: add memory tuning with GOMEMLIMIT (#27914)
Signed-off-by: Julian-Chu <[email protected]>
This commit is contained in:
@@ -103,6 +103,7 @@ Currently, the following organizations are **officially** using Argo CD:
|
||||
1. [DaoCloud](https://daocloud.io/)
|
||||
1. [Datarisk](https://www.datarisk.io/)
|
||||
1. [Daydream](https://daydream.ing)
|
||||
1. [Delivery Hero](https://www.deliveryhero.com/)
|
||||
1. [Deloitte](https://www.deloitte.com/)
|
||||
1. [Dematic](https://www.dematic.com)
|
||||
1. [Deutsche Telekom AG](https://telekom.com)
|
||||
|
||||
@@ -632,6 +632,35 @@ $ kubectl port-forward svc/argocd-metrics 8082:8082
|
||||
$ go tool pprof http://localhost:8082/debug/pprof/heap
|
||||
```
|
||||
|
||||
## Mitigating OOMKilled Events from Memory Spikes
|
||||
|
||||
To mitigate `OOMKilled` events caused by sudden memory spikes without over-provisioning resources, you can configure the `GOMEMLIMIT` environment variable on the relevant Argo CD containers (supported in Argo CD versions >= 2.7.0).
|
||||
|
||||
Setting `GOMEMLIMIT` to **80%–90%** of your container's total memory limit forces the Go runtime to trigger garbage collection before the Kubernetes hard limit is reached. For more detail, see the [Go GC Guide](https://go.dev/doc/gc-guide#Memory_limit) and the [Environment variables](https://pkg.go.dev/runtime#hdr-Environment_Variables) reference.
|
||||
|
||||
```yaml
|
||||
containers:
|
||||
- name: argocd-application-controller
|
||||
resources:
|
||||
limits:
|
||||
memory: "2Gi"
|
||||
env:
|
||||
- name: GOMEMLIMIT
|
||||
value: "1800MiB" # ~90% of the 2Gi memory limit above; GOMEMLIMIT uses MiB/GiB units
|
||||
```
|
||||
|
||||
### Known Use Cases
|
||||
|
||||
* Application controller cold-start memory spike
|
||||
* Expensive per-request memory spikes in argocd-server
|
||||
|
||||
### Trade-Offs & Tuning
|
||||
|
||||
> [!WARNING]
|
||||
> Setting `GOMEMLIMIT` too close to the application's actual working set can cause **GC thrashing**. The Go runtime will spend excessive CPU cycles continuously attempting to reclaim memory, significantly degrading application performance.
|
||||
|
||||
If you observe sustained high CPU utilization alongside frequent GC activity or ongoing `OOMKilled` events, increase the container's total memory limit and recalculate `GOMEMLIMIT` proportionally to give the runtime more breathing room.
|
||||
|
||||
## Shallow Clone
|
||||
|
||||
Repositories with large histories or large files in past revisions can be slow to clone and update. To speed up the clone process, you can use the `depth: "1"` repository option:
|
||||
|
||||
Reference in New Issue
Block a user