Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/valkey-cluster] Valkey Eviction Policy #31471

Closed
DasMagischeToastbrot opened this issue Jan 20, 2025 · 8 comments
Closed

[bitnami/valkey-cluster] Valkey Eviction Policy #31471

DasMagischeToastbrot opened this issue Jan 20, 2025 · 8 comments

Comments

@DasMagischeToastbrot
Copy link

Name and Version

bitnami/valkey-cluster 2.1.1

What is the problem this feature will solve?

My Valkey-cluster helm chart crashes because of memory pressure and there isn't any eviciton policy,

What is the feature you are proposing to solve the problem?

The Valkey clusterhelm chart https://artifacthub.io/packages/helm/bitnami/valkey-cluster should support also the eviction of old keys like in https://valkey.io/topics/lru-cache/ described. Within this general valkey setup we can configure that old keys expire, see:

Eviction policies
The exact behavior Valkey follows when the maxmemory limit is reached is configured using the maxmemory-policy configuration directive.

The following policies are available:

noeviction: New values aren't saved when memory limit is reached. When a database uses replication, this applies to the primary database
allkeys-lru: Keeps most recently used keys; removes least recently used (LRU) keys
allkeys-lfu: Keeps frequently used keys; removes least frequently used (LFU) keys
volatile-lru: Removes least recently used keys with a time-to-live (TTL) set.
volatile-lfu: Removes least frequently used keys with a TTL set.
allkeys-random: Randomly removes keys to make space for the new data added.
volatile-random: Randomly removes keys with a TTL set.
volatile-ttl: Removes keys with a TTL set, the keys with the shortest remaining time-to-live value first.

What alternatives have you considered?

No response

@github-actions github-actions bot added the triage Triage is needed label Jan 20, 2025
@javsalgar javsalgar changed the title Valkey Eviction Policy [bitnami/valkey-cluster] Valkey Eviction Policy Jan 20, 2025
@javsalgar
Copy link
Contributor

Hi!

Thank you so much for reporting! Would this value help?

valkey:
  ## @param valkey.configmap Additional Valkey configuration for the nodes
  ## ref: https://valkey.io/topics/config
  ##
  configmap: ""

Something like this:

valkey:
  configmap:  |
    maxmemory-policy noeviction

@DasMagischeToastbrot
Copy link
Author

@javsalgar yes this would help a lot to configure like you said:

valkey:
configmap: |
maxmemory-policy: volatile-lru

@javsalgar
Copy link
Contributor

Hi,

Did you try it? Did you find any issue? The value already existis in the chart.

@DasMagischeToastbrot
Copy link
Author

DasMagischeToastbrot commented Jan 22, 2025

I didn't see the value in the documentation https://artifacthub.io/packages/helm/bitnami/valkey-cluster

Is it on the correct level?

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
  name: valkey
  namespace: my-test
spec:
  interval: 1h0m0s
  url: oci://registry-1.docker.io/bitnamicharts/valkey-cluster
  ref:
    tag: 2.1.1
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: valkey
  namespace: my-test
spec:
  chartRef:
    kind: OCIRepository
    name: valkey
    namespace: my-test
  interval: 10m
  valuesFrom:
    - kind: ConfigMap
      name: valkey-values
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: valkey-values
  namespace: my-test
data:
  values.yaml: |
    cluster:
      nodes: 6
    existingSecret: my-valkey-password
    **maxmemory-policy: volatile-lru**
    metrics:
      service:
        ports:
          http: 8010
      enabled: true
    valkey:
      resourcesPreset: micro
    pdb:
      maxUnavailable: "2"
    networkPolicy:
      enabled: false

@javsalgar
Copy link
Contributor

It would be like

  values.yaml: |
    cluster:
      nodes: 6
    existingSecret: my-valkey-password
    metrics:
      service:
        ports:
          http: 8010
      enabled: true
    valkey:
      resourcesPreset: micro
      configmap:  |
        maxmemory-policy noeviction
    pdb:
      maxUnavailable: "2"
    networkPolicy:
      enabled: false

@DasMagischeToastbrot
Copy link
Author

DasMagischeToastbrot commented Jan 27, 2025

@javsalgar thank you very much, I tried as you mentioned:

  values.yaml: |
    cluster:
      nodes: 6
    existingSecret: my-valkey-password
    metrics:
      service:
        ports:
          http: 8010
      enabled: true
    valkey:
      resourcesPreset: micro
      configmap:  |
        maxmemory-policy: allkeys-lru
        maxmemory: 350mb
    pdb:
      maxUnavailable: "2"
    networkPolicy:
      enabled: false

But I get:

valkey-valkey-cluster *** FATAL CONFIG FILE ERROR (Version 8.0.2) *** valkey-valkey-cluster Reading the configuration file, at line 2261 valkey-valkey-cluster >>> 'maxmemory-policy: allkeys-lru'
valkey-valkey-cluster Bad directive or wrong number of arguments

@javsalgar
Copy link
Contributor

Could you try removing the :? I think it is without colons

@DasMagischeToastbrot
Copy link
Author

Thank you very much @javsalgar, this worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants