Skip to content

Loki High CPU Usage #3020

Closed
Closed
@cf-sewe

Description

@cf-sewe

Describe the bug
After some time, loki is running on 100% CPU.

To Reproduce
Steps to reproduce the behavior:

  • unable to reproduce by algorithm, happens after some time
  • happend 2 times , in different environments
  • Originally reported in Slack, some weeks ago

Expected behavior

Environment:

  • Kubernetes 1.18 (AWS)
  • loki monolithic deployment via Helm
    • Loki v2.0.0 is running with CPU limit of 1 (1 core). Loki is running quite idle normally.
    • Promtail 2.0.0
  • boltdb-shipper
  • AWS S3

Screenshots, Promtail config, or terminal output

  • pprof summary:
Showing nodes accounting for 5400ms, 63.83% of 8460ms total
Dropped 88 nodes (cum <= 42.30ms)
Showing top 10 nodes out of 111
      flat  flat%   sum%        cum   cum%
     760ms  8.98%  8.98%      760ms  8.98%  runtime.duffcopy
     760ms  8.98% 17.97%      770ms  9.10%  unicode/utf8.DecodeRuneInString
     720ms  8.51% 26.48%     1510ms 17.85%  github.com/prometheus/prometheus/promql/parser.(*Lexer).next
     690ms  8.16% 34.63%      800ms  9.46%  runtime.step
     610ms  7.21% 41.84%     1440ms 17.02%  runtime.pcvalue
     450ms  5.32% 47.16%     7920ms 93.62%  github.com/prometheus/prometheus/promql/parser.(*yyParserImpl).Parse
     440ms  5.20% 52.36%     2230ms 26.36%  runtime.gentraceback
     370ms  4.37% 56.74%      870ms 10.28%  github.com/prometheus/prometheus/promql/parser.lexInsideBraces
     330ms  3.90% 60.64%     3100ms 36.64%  github.com/prometheus/prometheus/promql/parser.(*Lexer).NextItem
     270ms  3.19% 63.83%      270ms  3.19%  runtime.futex
  • pprof trace (10s)
    pprof_trace.zip

  • loki 100 % in k9s
    image

  • grafana dashboard
    image

  • kubernetes dashboard for loki-stack
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions