Using Dragonfly

The proxy also works with Dragonfly, there are a couple of settings that must be taken care of though,

the Dragonfly instance must be started using --cluster_mode=emulated --lock_on_hashtags

and if you do not have enough ram memory you may limit the number of threads with --proactor_threads=4 (for example, will just limit to max 4 threads).

Finally, we need to set a default prefix for all our queues so that we can take advantage of the lock_on_hashtags setting (you can read more on why this is needed here)

So for example if we where to use docker-compose for runnig the proxy with Dragonfly instead of Redis™ it will look like this:

version: '3'
services:
  proxy:
    image: ghcr.io/taskforcesh/bullmq-proxy:latest
    ports:
      - 8080:8080
    environment:
      PORT: 8080
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: ${REDIS_PASSWORD}
      REDIS_TLS: ${REDIS_TLS}
      AUTH_TOKENS: ${AUTH_TOKENS}
      QUEUE_PREFIX: '{b}'
  dragonflydb:
    image: docker.dragonflydb.io/dragonflydb/dragonfly
    environment:
      DFLY_cluster_mode: emulated
      DFLY_lock_on_hashtags: true
    ports:
      - 6379:6379

Last updated