Skip to content

Commit 9b2b2f9

Browse files
authored
Beyla memory management (#10)
1 parent 5d652c6 commit 9b2b2f9

File tree

4 files changed

+54
-5
lines changed

4 files changed

+54
-5
lines changed

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: collector
33
description: A Helm chart for Better Stack Collector - monitoring solution that collects metrics, logs, and traces
44
type: application
5-
version: 0.1.9
5+
version: 0.1.10
66
appVersion: "latest"
77
keywords:
88
- monitoring

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ Better Stack collector is the easiest and recommended way of integrating Better
1212

1313
[Getting started ⇗](https://betterstack.com/docs/logs/collector/#getting-started)
1414

15+
## System Requirements
16+
17+
### Memory Requirements
18+
19+
The Better Stack collector runs as a DaemonSet with two containers per node:
20+
- **Collector container**: 512MB-2GB memory
21+
- **Beyla container** (eBPF tracing): 1.5GB memory reserved
22+
23+
**Minimum recommended node specifications:**
24+
- 4GB total memory per node
25+
- 2GB available memory after system and other critical workloads
26+
27+
**Important notes:**
28+
- The Beyla container requires 1.5GB memory reservation to ensure stable eBPF-based tracing
29+
- In memory-constrained or heavily overcommitted clusters, the collector may experience restarts
30+
- Both containers are configured with Guaranteed QoS class to prevent eviction under memory pressure
31+
1532
## Need help?
1633

1734
Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help!

templates/daemonset.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,32 @@ spec:
142142
value: /etc/beyla/beyla.yaml
143143
- name: ENABLE_DOCKERPROBE
144144
value: {{ .Values.beyla.dockerprobe.enabled | quote }}
145+
- name: GOMEMLIMIT
146+
value: {{ .Values.beyla.env.GOMEMLIMIT | quote }}
147+
{{- if .Values.beyla.memoryRestartThreshold }}
148+
livenessProbe:
149+
exec:
150+
command:
151+
- /bin/sh
152+
- -c
153+
- |
154+
BEYLA_PID=$(pgrep -f '^/usr/local/bin/beyla' | head -1)
155+
if [ -z "$BEYLA_PID" ]; then
156+
echo "Beyla process not found"
157+
exit 1
158+
fi
159+
MEM_USAGE=$(cat /proc/$BEYLA_PID/status | grep VmRSS | awk '{print int($2/1024)}')
160+
THRESHOLD={{ .Values.beyla.memoryRestartThreshold }}
161+
if [ "$MEM_USAGE" -gt "$THRESHOLD" ]; then
162+
echo "Beyla memory usage ${MEM_USAGE}MiB exceeds threshold ${THRESHOLD}MiB"
163+
exit 1
164+
fi
165+
exit 0
166+
initialDelaySeconds: 60
167+
periodSeconds: 30
168+
timeoutSeconds: 5
169+
failureThreshold: 2
170+
{{- end }}
145171
volumeMounts:
146172
{{- if .Values.beyla.dockerprobe.enabled }}
147173
- name: docker-metadata

values.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ collector:
2222
cpu: 2000m
2323
memory: 2Gi
2424
requests:
25-
cpu: 500m
26-
memory: 512Mi
25+
cpu: 2000m
26+
memory: 2Gi
2727

2828
# Node selector
2929
nodeSelector: {}
@@ -61,6 +61,7 @@ beyla:
6161
BEYLA_KUBE_METADATA_ENABLE: "true"
6262
BEYLA_METRICS_INTERVAL: "15s"
6363
BEYLA_NETWORK_METRICS: "false"
64+
GOMEMLIMIT: 1400MiB
6465

6566
# Docker probe configuration
6667
dockerprobe:
@@ -72,8 +73,13 @@ beyla:
7273
cpu: 1000m
7374
memory: 1536Mi
7475
requests:
75-
cpu: 250m
76-
memory: 512Mi
76+
cpu: 1000m
77+
memory: 1536Mi
78+
79+
# Memory restart threshold in MiB (optional)
80+
# If set, beyla will restart when memory usage exceeds this value
81+
# Should be set below the memory limit to prevent OOM kills
82+
memoryRestartThreshold: 1450
7783

7884
# RBAC configuration
7985
rbac:

0 commit comments

Comments
 (0)