0

I have a microservice deployed with 5 replicas on Kubernetes.

spec:
  replicas: 5
  selector:
    matchLabels:
      app: XXX
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: XXX
    spec:
      containers:
        - name: XXX
          image: XXX
          imagePullPolicy: Always
          resources:
            limits:
              cpu: 1000m
              memory: 1024Mi
            requests:
              cpu: 200m
              memory: 128Mi

Resources has limits of 1024Mi of memory and 1000m for cpu, but each time I call a service, after 9 seconds I get:

    <--- Last few GCs --->

[93:0x55a8bd3f57a0]  3122084 ms: Mark-sweep (reduce) 510.9 (518.0) -> 510.3 (518.5) MB, 1115.1 / 0.6 ms  (average mu = 0.106, current mu = 0.007) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
Aborted (core dumped)

And then the pod crash and it restarts.

But, when I see the resource just in the time when the service was called, I see that is far of reach the limits of memory nor cpu (right a 21:41):

enter image description here

How can I determinate that I'm having a memory problem? Should I rise more memory and/or cpu?

pmiranda
  • 7,602
  • 14
  • 72
  • 155

0 Answers0