Skip to content

DragonflyDB Setup

#Why DragonflyDB is required

Accelerate Guru uses DragonflyDB as its caching layer. DragonflyDB is a modern, open-source, Redis-compatible in-memory store. It speaks the exact same protocol as Redis — every Redis client works with it out of the box — but it is architecturally different in ways that matter for Magento workloads.

#DragonflyDB vs Redis: why it matters

RedisDragonflyDB
ArchitectureSingle-threaded event loopMulti-threaded, shared-nothing
Throughput (commodity server)~100K ops/s~1M–4M ops/s
Memory efficiencyBaseline30–40% less RAM for same data
Latency at loadDegrades under heavy loadStays flat
LicenseBSD + SSPL (v7+)BSL 1.1 (free for all uses)
Redis compatibilityNativeFull protocol compatibility
InstallationManual tuning requiredWorks well with defaults

For a Magento store at peak traffic (product launches, sales events), Redis can become a bottleneck. DragonflyDB scales with available CPU cores and never becomes the bottleneck — it is routinely faster than the network itself.

Note

If you already have a Redis instance running, Accelerate Guru can connect to it. Point redis_host / redis_port at your Redis server. You will not get the throughput benefits of DragonflyDB, but everything else works identically.


#Install DragonflyDB

#Ubuntu / Debian

# Import the signing key
curl -fsSL https://packages.dragonflydb.io/gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/dragonflydb.gpg

# Add the repository
echo "deb [signed-by=/usr/share/keyrings/dragonflydb.gpg] \
  https://packages.dragonflydb.io/apt stable main" \
  | sudo tee /etc/apt/sources.list.d/dragonflydb.list

# Install
sudo apt update && sudo apt install -y dragonflydb

# Enable and start
sudo systemctl enable --now dragonflydb

#RHEL / Rocky Linux / AlmaLinux / CentOS Stream

# Add the YUM repo
sudo tee /etc/yum.repos.d/dragonflydb.repo << 'EOF'
[dragonflydb]
name=DragonflyDB
baseurl=https://packages.dragonflydb.io/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.dragonflydb.io/gpg
EOF

sudo dnf install -y dragonflydb
sudo systemctl enable --now dragonflydb

#macOS (Homebrew)

brew install dragonflydb
brew services start dragonflydb

#Docker

docker run -d \
  --name dragonflydb \
  -p 127.0.0.1:6379:6379 \
  --ulimit memlock=-1 \
  docker.dragonflydb.io/dragonflydb/dragonfly:latest \
  dragonfly --bind 0.0.0.0 --port 6379

Tip

The --ulimit memlock=-1 flag is important — DragonflyDB uses mlock to pin pages in RAM and avoid latency spikes from page faults. Without it, performance degrades under memory pressure.

#Manual binary install

# Download the latest binary
curl -fsSL https://github.com/dragonflydb/dragonfly/releases/latest/download/dragonfly-amd64.tar.gz \
  | tar -xz
sudo install -m 0755 dragonfly /usr/local/bin/dragonfly

#Verify it is running

redis-cli ping

Expected response: PONG

If redis-cli is not installed:

# Ubuntu / Debian
sudo apt install -y redis-tools

# RHEL / Rocky
sudo dnf install -y redis

# macOS
brew install redis   # installs redis-cli without the server

Additional verification — check that DragonflyDB is listening:

redis-cli info server | grep dragonfly
# → dragonfly_version:1.x.x

DragonflyDB works well with its defaults. For production, consider adding a configuration file at /etc/dragonflydb/dragonflydb.conf (or passing flags to the unit):

# /etc/dragonflydb/dragonflydb.conf

# Bind only to loopback — do not expose to the network
bind              127.0.0.1
port              6379

# Maximum memory. DragonflyDB evicts LRU entries when this is reached.
# Set to 60-70% of available RAM, leaving room for Accelerate Guru and OS.
maxmemory         4gb
maxmemory-policy  allkeys-lru

# Persist to disk for faster warm restart after reboot (optional)
# dbfilename        dump.rdb
# dir               /var/lib/dragonflydb

For the systemd unit, pass flags via the ExecStart override:

sudo systemctl edit dragonflydb

Add:

[Service]
ExecStart=
ExecStart=/usr/bin/dragonfly --bind 127.0.0.1 --port 6379 --maxmemory 4gb

#Connect Accelerate Guru to DragonflyDB

In /etc/accelerate-guru/magento_ultra.ini:

[cache]
enabled      = true
redis_host   = 127.0.0.1   ; DragonflyDB host
redis_port   = 6379         ; DragonflyDB port
redis_password =            ; leave empty if no auth
redis_db     = 0            ; database index (0–15)

Tip

If DragonflyDB is on a different server, replace 127.0.0.1 with its private IP address. Use a private/VPC network — never expose DragonflyDB on a public IP.


#What happens without DragonflyDB

If DragonflyDB is not running or not reachable when Accelerate Guru starts:

  1. Accelerate Guru logs a warning at startup: Cache disabled — cannot reach DragonflyDB at 127.0.0.1:6379
  2. The proxy continues running as a transparent pass-through — all requests are forwarded to Magento.
  3. All other features (WAF, image optimisation, HTML rewriting, compression) continue to work.
  4. Performance will be significantly lower than with caching enabled.

This means your store never goes down because DragonflyDB is unavailable — Accelerate Guru degrades gracefully.

Once DragonflyDB comes back online, caching resumes automatically on the next request without a restart.


#DragonflyDB and Magento's own Redis

If your Magento installation already uses Redis for session storage or the built-in Full Page Cache, you have two options:

Option A (recommended): Run DragonflyDB on a different port

dragonfly --bind 127.0.0.1 --port 6380

Then in magento_ultra.ini:

[cache]
redis_port = 6380

Option B: Share the same DragonflyDB instance

Use a different database index:

[cache]
redis_db = 2    ; Magento typically uses db 0 and db 1

Accelerate Guru stores all its cache keys prefixed with sa: (page cache), sa:asset: (CSS/JS), sa:img: (images), and sa:dim: (image dimensions), so there is no collision risk — but separate instances are cleaner.


#Security

DragonflyDB (like Redis) has no authentication by default. Always:

  1. Bind to 127.0.0.1 (loopback) or a private network interface, never 0.0.0.0 on a public server.
  2. Set a password if DragonflyDB is accessible over a network:
; In dragonflydb.conf
requirepass your-strong-random-password
; In magento_ultra.ini
[cache]
redis_password = your-strong-random-password