DEV Community

Cover image for Dragonfly DB: A Promising Alternative to Redis
Mukesh Kuiry
Mukesh Kuiry

Posted on

Dragonfly DB: A Promising Alternative to Redis

Dragonfly DB is a drop-in replacement for Redis.

It's known for its high operation rate.

Dragonfly DB is multi-threaded, and Redis is single-threaded, which makes it faster. For example, if your machine has 12 cores, Redis can only use 1 core, whereas Dragonfly DB is designed to use the maximum possible cores.

To scale Redis, we need to create multiple copies of it and scale horizontally, whereas in the case of Dragonfly DB, we can scale it vertically.

Dragonfly DB is written in C++ and uses the Boost.Fiber library to execute on multiple processes.

The architecture that makes Dragonfly DB possible is the "share-nothing" architecture.

In this architecture, the namespace is shared into n parts, where n is the number of logical CPU cores.

Each data block gets its own set of heap data structures to execute separately. You can say it's an orchestrated group of multiple Redis processes.

Now, in the case of multi-access architecture, the main problem is mutex locks. To solve this problem, they used a message bus where all the incoming connection requests are placed, and a connection pool is created. The message worker eventually picks the connections and pairs them with the suitable data block.

This beautiful architecture makes Dragonfly DB faster and more efficient.

Follow for upcoming posts to learn more!

Top comments (0)