gorush icon indicating copy to clipboard operation
gorush copied to clipboard

High CPU Usage on Idle in Docker (v1.18.9)

Open maximality opened this issue 11 months ago • 0 comments

We are using Gorush (v1.18.9) inside Docker, and we’ve noticed that it consumes ~30-40% of CPU while idle (no messages are being sent).

Environment

Gorush Version: v1.18.9 Deployment: Running inside Docker System: Hetzner VPS with 4 cores and Ubuntu 24.04 Configuration:

core:
  enabled: false # enable httpd server
  address: "" # ip address to bind (default: any)
  shutdown_timeout: 30 # default is 30 second
  port: "8088" # ignore this port number if auto_tls is enabled (listen 443).
  worker_num: 0 # default worker number is runtime.NumCPU()
  queue_num: 0 # default queue number is 8192
  max_notification: 100
  # set true if you need get error message from fail push notification in API response.
  # It only works when the queue engine is local.
  sync: false
  # set webhook url if you need get error message asynchronously from fail push notification in API response.
  feedback_hook_url: ""
  feedback_timeout: 10 # default is 10 second
  feedback_header:
  mode: "release"
  ssl: false
  cert_path: "cert.pem"
  key_path: "key.pem"
  cert_base64: ""
  key_base64: ""
  http_proxy: ""
  pid:
    enabled: false
    path: "gorush.pid"
    override: true
  auto_tls:
    enabled: false # Automatically install TLS certificates from Let's Encrypt.
    folder: ".cache" # folder for storing TLS certificates
    host: "" # which domains the Let's Encrypt will attempt

grpc:
  enabled: true  # enable gRPC server
  port: 9000

api:
  push_uri: "/api/push"
  stat_go_uri: "/api/stat/go"
  stat_app_uri: "/api/stat/app"
  config_uri: "/api/config"
  sys_stat_uri: "/sys/stats"
  metric_uri: "/metrics"
  health_uri: "/healthz"

android:
  enabled: true
  key_path: "/home/gorush/fcm.json"
  credential: ""
  max_retry: 0

huawei:
  enabled: false
  appsecret: "YOUR_APP_SECRET"
  appid: "YOUR_APP_ID"
  max_retry: 0 # resend fail notification, default value zero is disabled

queue:
  engine: "redis" # support "local", "nsq", "nats" and "redis" default value is "local"
  nsq:
    addr: 127.0.0.1:4150
    topic: gorush
    channel: gorush
  nats:
    addr: 127.0.0.1:4222
    subj: gorush
    queue: gorush
  redis:
    addr: redis:6379
    group: gorush
    consumer: gorush
    stream_name: gorush

ios:
  enabled: true
  key_path: "/home/gorush/apple_secret.p8"
  key_base64: "" # load iOS key from base64 input
  key_type: "p8" # could be pem, p12 or p8 type
  password: "" # certificate password, default as empty string.
  production: false
  max_concurrent_pushes: 100 # just for push ios notification
  max_retry: 0 # resend fail notification, default value zero is disabled
  key_id: KEY_ID_HERE #KeyID from developer account (Certificates, Identifiers & Profiles -> Keys)
  team_id: TEAM_ID_HERE # TeamID from developer account (View Account -> Membership)

log:
  format: "string" # string or json
  access_log: "stdout" # stdout: output to console, or define log path like "log/access_log"
  access_level: "debug"
  error_log: "stderr" # stderr: output to console, or define log path like "log/error_log"
  error_level: "error"
  hide_token: true
  hide_messages: false

stat:
  engine: "redis" # support memory, redis, boltdb, buntdb or leveldb
  redis:
    cluster: false
    addr: "redis:6379" # if cluster is true, you may set this to "localhost:6379,localhost:6380,localhost:6381"
    password: "PASSWORD_HERE"
    db: 0
  boltdb:
    path: "bolt.db"
    bucket: "gorush"
  buntdb:
    path: "bunt.db"
  leveldb:
    path: "level.db"
  badgerdb:
    path: "badger.db"

Observations

Gorush is consuming high CPU even when it's not actively sending notifications.

Below are screenshots of system resource usage:

TOP command output:

Image

Docker stats output:

Image

Gorush logs from Docker container:

Image

Steps to Reproduce

  • Run Gorush inside Docker using the latest release (v1.18.9).
  • Observe CPU usage when no push notifications are being sent.

Expected Behavior

Gorush should not consume significant CPU when idle.

Questions / Help Needed

  • Are there known issues or potential reasons why Gorush consumes high CPU while idle?
  • Are there any debugging steps we can take to identify the root cause?

Any guidance would be greatly appreciated! Thanks.

maximality avatar Jan 30 '25 13:01 maximality