Dragonfly
Modern Redis and Memcached compatible in-memory datastore.
Overview
Dragonfly is a modern, high-performance in-memory datastore that serves as a drop-in replacement for Redis and Memcached. Developed from the ground up with modern hardware in mind, Dragonfly leverages a multi-threaded, shared-nothing architecture to deliver up to 25x higher throughput than Redis while using 80% less memory. Unlike traditional single-threaded Redis, Dragonfly is designed for vertical scaling on multi-core systems and can handle millions of operations per second on a single node.
This Docker deployment provides Dragonfly configured with dual protocol support, enabling applications to connect using either Redis or Memcached client libraries without modification. The container runs with optimized memory lock settings and persistent data storage, making it suitable for production workloads that require both high performance and data durability. The configuration exposes the standard Redis port 6379 while maintaining full compatibility with existing Redis commands and data structures.
This stack is ideal for organizations looking to upgrade their caching layer performance without application changes, startups building high-throughput applications, and developers who need a single solution that can replace both Redis and Memcached instances. The vertical scaling capabilities make it particularly valuable for scenarios where traditional Redis clustering complexity isn't desired but higher performance is required.
Key Features
- Dual protocol support for Redis and Memcached clients on the same instance
- 25x higher throughput than Redis with 80% lower memory usage
- Multi-threaded architecture optimized for modern multi-core systems
- Vertical scaling without the complexity of clustering or sharding
- Full Redis API compatibility including advanced data structures
- Built-in memory optimization with intelligent data compression
- Lock-free data structures for maximum concurrent performance
- Native support for both Redis RESP protocol and Memcached text protocol
Common Use Cases
- 1High-traffic web applications requiring faster session storage and caching
- 2Gaming platforms needing low-latency leaderboards and real-time data
- 3E-commerce sites with heavy product catalog and shopping cart operations
- 4Financial services requiring high-frequency data processing and caching
- 5Content delivery networks needing efficient edge caching
- 6Microservices architectures consolidating Redis and Memcached dependencies
- 7Development environments wanting unified caching for mixed-protocol applications
Prerequisites
- Minimum 4GB RAM recommended for optimal performance benefits
- Multi-core CPU to leverage Dragonfly's threading advantages
- Port 6379 available for Redis protocol connections
- Understanding of Redis commands and data structures
- Familiarity with either Redis or Memcached client libraries
- Docker host with sufficient memory limits configured
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 dragonfly: 3 image: docker.dragonflydb.io/dragonflydb/dragonfly:latest4 container_name: dragonfly5 restart: unless-stopped6 ulimits: 7 memlock: -18 volumes: 9 - dragonfly_data:/data10 ports: 11 - "6379:6379"12 networks: 13 - dragonfly-network1415volumes: 16 dragonfly_data: 1718networks: 19 dragonfly-network: 20 driver: bridge.env Template
.env
1# Dragonfly default configurationUsage Notes
- 1Docs: https://www.dragonflydb.io/docs
- 2Redis-compatible on port 6379 - drop-in Redis replacement
- 325x throughput of Redis, 80% lower memory usage
- 4Supports both Redis and Memcached protocols
- 5Multithreaded and vertically scalable on single node
- 6Test: redis-cli ping or echo 'stats' | nc localhost 11211 (memcached)
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 dragonfly:5 image: docker.dragonflydb.io/dragonflydb/dragonfly:latest6 container_name: dragonfly7 restart: unless-stopped8 ulimits:9 memlock: -110 volumes:11 - dragonfly_data:/data12 ports:13 - "6379:6379"14 networks:15 - dragonfly-network1617volumes:18 dragonfly_data:1920networks:21 dragonfly-network:22 driver: bridge23EOF2425# 2. Create the .env file26cat > .env << 'EOF'27# Dragonfly default configuration28EOF2930# 3. Start the services31docker compose up -d3233# 4. View logs34docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/dragonfly/run | bashTroubleshooting
- Connection refused on port 6379: Check if another Redis instance is running and conflicting with the port binding
- High memory usage despite claims of efficiency: Ensure ulimits memlock is properly set to -1 in the container configuration
- Memcached protocol not responding: Verify your Memcached client is connecting to port 6379, not the traditional 11211
- Performance not meeting expectations: Check CPU core count as Dragonfly requires multiple cores for optimal threading benefits
- Data persistence issues: Verify the dragonfly_data volume is properly mounted and has sufficient disk space
- Redis commands returning errors: Ensure you're using supported Redis commands as some newer Redis 7+ features may not be implemented
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download