Skip to main content

Using Dragonfly

warning

This tutorial is a community contribution and is not supported by the Open WebUI team. It serves only as a demonstration on how to customize Open WebUI for your specific use case. Want to contribute? Check out the contributing tutorial.

What is Dragonfly?​

Dragonfly (source on GitHub) is an in-memory data store that speaks the Redis protocol, so Open WebUI talks to it through the same REDIS_* settings. This is the same setup as the Redis tutorial with the Dragonfly image swapped in. Dragonfly is not part of what Open WebUI tests; see Step 2: Add Redis for what that means.

When do you need it?​

The same as for Redis: see When is Redis Required?.

Setting up Dragonfly​

Create a docker-compose.yml:

services:
  dragonfly:
    image: docker.dragonflydb.io/dragonflydb/dragonfly
    container_name: dragonfly
    ulimits:
      memlock: -1
    volumes:
      - dragonfly-data:/data
    command: "dragonfly --dir=/data --snapshot_cron='*/30 * * * *' --maxclients=10000 --timeout=1800"
    restart: unless-stopped
    networks:
      - openwebui-network

volumes:
  dragonfly-data:

networks:
  openwebui-network:
    external: true

The image ships its own health check, so none is needed here. Create the shared network if you do not have one yet:

docker network create openwebui-network

The flags map to the Redis ones in Critical: Redis Server Configuration like this:

Redis tutorialDragonfly
--maxclients 10000--maxclients=10000
--timeout 1800--timeout=1800
--maxmemory-policy noevictionNothing to set. Dragonfly only evicts when started with --cache_mode=true, so leave that off.
--save and --appendonly yes--dir with --snapshot_cron, which writes periodic snapshots. Append-only files were not tested.
Do not use --cache_mode=true

Cache mode evicts keys when memory runs low. Open WebUI stores session state, locks and shared configuration in the same Redis, so eviction can drop them. This is the same reason the Redis tutorial requires noeviction.

Connecting Open WebUI​

Point Open WebUI at the Dragonfly container. The variables and the redis:// scheme are unchanged; only the host (the container name) differs:

REDIS_URL="redis://dragonfly:6379/0"
WEBSOCKET_MANAGER="redis"

Run Dragonfly as a single standalone server, since its cluster mode does not carry the pub/sub that live updates depend on; see Step 2: Add Redis.

Verify​

docker exec -it dragonfly redis-cli ping    # → PONG

The dragonfly image includes redis-cli. To confirm the replicas share state, open redis-cli and run KEYS open-webui*. Keys such as open-webui:session_cleanup_lock and open-webui:usage_cleanup_lock appear once a replica is up.

Tested configuration​

Checked with Open WebUI 0.13.5 (ghcr.io/open-webui/open-webui:main) and Dragonfly v2.1, against Redis 8 as a control, with two Open WebUI replicas sharing one Postgres database and one Redis. WEBSOCKET_MANAGER=redis and ENABLE_WEBSOCKET_SUPPORT=true were set. Both servers gave the same results:

  • A user created on replica A could sign in on replica B, and A's token was accepted on B.
  • A typing event emitted by a socket.io client on replica A reached a client on replica B, which exercises the Redis pub/sub path.
  • A change to an admin setting on A was visible on B.
  • The Open WebUI cleanup locks and rate limit keys appeared on the server, and neither replica logged a Redis, Lua or script error.
  • The four Lua scripts in the Open WebUI source (lock renew, lock release, response stream append and temporary chat ownership) returned the expected results when run directly, 12 of 12 checks on both servers.

This ran on one standalone server without authentication or TLS. Dragonfly clusters, Sentinel-style failover, Open WebUI's REDIS_CLUSTER and REDIS_SENTINEL_HOSTS settings, append-only persistence and load at scale were not tested.

Everything else is identical to Redis​

Because Open WebUI speaks to Dragonfly over the Redis protocol, the configuration and troubleshooting in the Redis Websocket Support tutorial apply as is. In particular:

Additional Resources​

This content is for informational purposes only and does not constitute a warranty, guarantee, or contractual commitment. Open WebUI is provided "as is." See your license for applicable terms.