dragonflydb / dragonfly-operator

A Kubernetes operator to install and manage Dragonfly instances.
https://www.dragonflydb.io/docs/managing-dragonfly/operator/installation
Apache License 2.0
142 stars 33 forks source link

maxmemory #71

Closed hermanbanken closed 1 year ago

hermanbanken commented 1 year ago

We deployed DragonflyDB using:

apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
  name: api-proxy-dragonfly
spec:
  replicas: 2
  resources:
    requests:
      cpu: 500m
      memory: 500Mi
    limits:
      cpu: 1000m
      memory: 1Gi

but this is output from the pod:

Screenshot 2023-05-26 at 17 07 01

This usage of 22GiB is a bit problematic, because it would OOM at 1GiB already because of the Kubernetes memory limit. Is there a way to read this maximum memory either for the operator or for the Dragonfly instance itself?

Edit, apparently this exists: https://github.com/dragonflydb/dragonfly/blob/bc717a037d77f7b027de910c5ca5c64bf34e2af9/src/server/dfly_main.cc#L482-L501 from https://github.com/dragonflydb/dragonfly/pull/1109 which is part of:

But we are running v1.2.1 and still the detector detects 28GiB and not the 1GiB from the Kubernetes limit.

I think it is due to our LXC having only /sys/fs/cgroup/memory/memory.limit_in_bytes and upon closer inspection of https://github.com/dragonflydb/dragonfly/pull/1109 it seems like that file is not read at all.

Screenshot 2023-05-26 at 17 23 09
hermanbanken commented 1 year ago

Opened a PR https://github.com/dragonflydb/dragonfly/pull/1293

Pothulapati commented 1 year ago

Hey @hermanbanken Thanks for not just raising the issue but also fixing it! Because the PR is merged, We can close the issue right?

Once a Dragonfly binary is released, You can expect an updated Operator release too! :)

hermanbanken commented 1 year ago

Cool, that is awesome, thanks!