Skip to content

Feature: Swappable Redis-Compatible KV stores  #32

@nickchomey

Description

@nickchomey

With Redis changing its license recently, a slew of Redis-compatible KV stores were forked/created/released (in addition to other promising ones that already existed). Decent enough background on that here.

The thought here is to make this more of a ddev kv command rather than just Redis (though it can stay as ddev redis), which could allow users to simply toggle between different Redis-compatible KV stores and their application code would presumably not need to change at all - it would still point to redis:6379 (or the unix socket equivalent).

This would make it easier to experiment with the various stores, without needing to create additional ddev addons or other project-specific custom dockerfiles.

In theory it should be as easy as just changing the docker image in use...

Here's DragonflyDB's Docker Compose installation instructions

Basically just download this docker-compose.yaml file and run docker compose up and then connect to it with redis-cli - it Just Works (tm) with localhost:6379 defaults.

version: '3.8'
services:
  dragonfly:
    image: 'docker.dragonflydb.io/dragonflydb/dragonfly'
    ulimits:
      memlock: -1
    ports:
      - "6379:6379"
    # For better performance, consider `host` mode instead `port` to avoid docker NAT.
    # `host` mode is NOT currently supported in Swarm Mode.
    # https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode
    # network_mode: "host"
    volumes:
      - dragonflydata:/data
volumes:
  dragonflydata:

(Interesting that they have an explicit note to use a host network for better performance! Probably relevant to #33, though likely not possible to implement in the context of DDEV).

I have to assume the rest of the Redis-compatible KV stores are similarly seamless drop-in replacements.

https://github.com/valkey-io/valkey - Linux Foundation Redis Fork
https://github.com/Snapchat/KeyDB - Snapchat's redis fork, which now has multithreading, active replicatoin and more. A bit stale/unmaintained though
https://github.com/dragonflydb/dragonfly - Very promising mutlithreaded Redis-compatible store
https://github.com/microsoft/Garnet - From microsoft, and has very promising benchmark stats and features
https://github.com/nalgeon/redka - Somewhat Redis-compatible, that sits on SQLite. Very interesting.
https://github.com/apache/kvrocks - From apache. Distributed via async replication
https://github.com/Tencent/Tendis

And PLENTY more. The point is not to officially find and support them all, but to make it easy to swap them in and out within the same redis DDEV container.

Perhaps the image could be defined in a redis-specific config file or project environment variable? Or just put all the docker compose files in the same directory and a ddev redis backend {dbname} command could toggle between them. Or something else - I'm sure there's a good, easy, flexible, robust way to implement this.

If there's any interest in this, I'll fiddle around to see how it might work.

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