Migrating from a Redis to Dragonfly
Dragonfly is a source-available, multi-threaded Redis® replacement built for modern cloud workloads. Migrate in minutes, no code changes required.
Install with Docker
Starting with docker run
is the simplest way to get up and running with Dragonfly.
If you do not have docker on your machine, Install Docker before continuing.
Prerequisites
- Minimum 4GB of RAM to get the benefits of Dragonfly
- Minimum 1 CPU Core
- Linux Kernel 4.19 or higher
On linux
docker run --network=host --ulimit memlock=-1 docker.dragonflydb.io/dragonflydb/dragonfly
In this blog post, you will learn how to migrate data from a Redis Cluster to a single-node Dragonfly instance. We will use a sample application to demonstrate the migration process and cover everything step by step.
Solving the most common causes of Redis failure: a comparison between Redis OSS and Dragonfly
You can use Dragonfly, in most scenarios, to act as a drop-in replacement for Redis — due to its API compatibility. As you can see below, Dragonfly directly addresses most of the common causes of Redis failure, dramatically reducing operational complexity and improving reliability.
RedisDragonflySingle-threaded: leads to bottlenecks and performance issues.Multi-threaded: faster and more reliable.For larger Redis instances, horizontally scaling is really the only option to improve performance, meaning you will need to maintain a Redis cluster.Can be vertically scaled, which is much simpler.Memory overload: this happens because Redis needs to process database transactions as well as run background tasks such as snapshots on a single thread.Memory spikes don’t happen during snapshotting: database transactions, and tasks like snapshotting, can all be spread across multiple threads and completed faster, so crashes are much less likely.You have to over-provision your servers to deal with the increased memory usage that comes with snapshotting.No need to over-provision your servers due to much more efficient use of the underlying hardware.
Dragonfly is easy to deploy and scales readily
Dragonfly is a drop-in Redis replacement with high throughput, low latency, and efficient memory management. We were motivated to create Dragonfly to deal with many of the issues we saw with Redis failures in our own deployments, including running out of memory, snapshotting issues, replication loops, and the need to over-provision your servers.
Dragonfly scales vertically, allowing you to vertically scale to over 1TB in data and 4 million queries per second — all on a single instance. When you require more capacity, you can simply resize your VM.
Redis touts its single-threaded architecture as a feature, not a bug, and argues that it still performs well when run as part of a cluster. But maintaining a cluster adds complexity to your deployments and makes them difficult to maintain, requiring constant re-tuning to perform optimally. While there are certainly sophisticated DevOps teams out there who have solved these Redis issues themselves through automation, we found it to be such a hassle that we decided to build an out of the box solution for other developers.
If you’d like to learn more, you can get started right away by viewing our docs or checking out the Dragonfly project on GitHub.
Scalability and Performance
In-memory databases have become one of the most important pieces of infrastructure underpinning modern, performance oriented applications. Redis is the most popular of these because of its simplicity — it’s quick to set up, easy to use, and scalable to meet the demands of a growing business.
However, Redis was designed over a decade ago, and due to its simplistic single-threaded architecture, scaling Redis deployments can be a long and frustrating experience for developers. Scaling and maintaining Redis clusters is complex and time consuming, and if you don’t maintain your Redis cluster correctly, you may lose data, which can lead to user experience issues or even a site outage.
Alternatively, you can use Dragonfly. Dragonfly works as a drop-in replacement for Redis and Memcached — it’s a modern in-memory database that’s been developed to build upon the success of its predecessors, while improving performance and reliability. Its multi-threaded architecture allows for more effective vertical scaling, so you can avoid the headache that comes with horizontal scaling and cluster management while still enjoying the benefits of scaling your website.
Benchmarks
In benchmarks, Dragonfly showed a 25X increase in throughput compared to Redis, crossing 3.8M QPS on c6gn.16xlarge.