Getting Started With Dragonfly

Dragonfly is a modern in-memory datastore, fully compatible with Redis and Memcached APIs. Dragonfly implements novel algorithms and data structures on top of a multi-threaded, shared-nothing architecture. As a result, Dragonfly reaches x25 performance compared to Redis and supports millions of QPS on a single instance.

Dragonfly’s core properties make it a cost-effective, high-performing, and easy-to-use Redis replacement.

License

Dragonfly is released under BSL 1.1. In short it means that it is free for use and free to change as long as you do not use it to provide a paying support or a competing managed services for Dragonfly. For details you can read the full license here.

Running the server

Dragonfly runs on linux. It uses relatively new linux specific io-uring API for I/O, hence it requires Linux version 5.10 or later. Debian/Bullseye, Ubuntu 20.04.4 or later fit these requirements.

With docker:

docker pull docker.dragonflydb.io/dragonflydb/dragonfly && \
docker tag docker.dragonflydb.io/dragonflydb/dragonfly dragonfly

docker run --network=host --ulimit memlock=-1 --rm dragonfly

redis-cli PING  # redis-cli can be installed with "apt install -y redis-tools"

–ulimit memlock=-1 is needed since some Linux distros configure the default memlock limit for containers as 64m. Naturally, as an in-memory datastore, Dragonfly requires more.

Additional configuration

Dragonfly supports redis run-time arguments where applicable. For example, you can run: docker run --network=host --ulimit memlock=-1 --rm dragonfly --requirepass=foo --bind localhost.

Dragonfly currently supports the following Redis arguments:

  • port
  • bind
  • requirepass
  • maxmemory
  • dir - by default, dragonfly docker uses /data folder for snapshotting. You can use -v docker option to map it to your host folder.
  • dbfilename

In addition, it has Dragonfly specific arguments options:

  • memcache_port - to enable memcached compatible API on this port. Disabled by default.
  • keys_output_limit - maximum number of returned keys in keys command. Default is 8192. keys is a dangerous command. we truncate its result to avoid blowup in memory when fetching too many keys.
  • dbnum - maximum number of supported databases for select.
  • cache_mode - see Cache section below.

For more options like logs management or tls support, run dragonfly --help.