Railway

Deploy Dragonfly — Redis Replacement, 25x Faster, No Cluster

Self-host Dragonfly: drop-in Redis replacement, 25x throughput. No cluster.

Deploy Dragonfly — Redis Replacement, 25x Faster, No Cluster

Just deployed

Deploy and Host Dragonfly on Railway

Dragonfly in-memory datastore

Dragonfly is the modern in-memory datastore with 30k+ GitHub stars — a drop-in replacement for Redis, Memcached, and Valkey that delivers up to 25x the throughput on a single node while using up to 80% fewer resources. Built from scratch in C++ with a multi-threaded, shared-nothing architecture, Dragonfly scales vertically across every CPU core with no cluster to manage. It speaks the Redis wire protocol natively, so you switch by changing one connection string — no code changes, same client libraries, same CLI.

Self-host on Railway for ~$5/month with a persistent volume. One Dragonfly instance can replace an entire Redis cluster for most production workloads — at a fraction of the memory and compute.


What This Template Deploys

ServicePurpose
DragonflyThe in-memory datastore — Redis/Memcached/Valkey-compatible, served on port 6379 over Railway's private network
Persistent VolumeMounted at /data for snapshot persistence — your cached data and datasets survive redeploys

Single-container, multi-threaded. No cluster, no sidecars, no sentinel. Dragonfly uses all available CPU cores on one instance — the vertical-scaling model that removes Redis Cluster's network round-trips and rebalancing overhead entirely.


About Hosting Dragonfly

Redis and Valkey are single-threaded at the core — scaling them means running a cluster with network hops, rebalancing, and failover risk. Dragonfly's shared-nothing design gives each shard its own CPU core with no locks, so it scales by adding cores to one box instead of nodes to a cluster — dramatically higher throughput at up to 80% lower cost for the same workload.

Railway runs Dragonfly as a managed container with a persistent volume and private networking. Point your existing Redis client at the Dragonfly host and port, and you're done.

Typical cost: ~$5/month on Railway's Hobby plan for a Dragonfly instance that can handle workloads it would take a multi-node Redis cluster to serve. Managed Redis clouds bill per-node and per-GB; Dragonfly on Railway is flat compute with far more headroom per dollar.


Deploy in Under 3 Minutes

  1. Click Deploy on Railway — Dragonfly builds automatically (~1–2 minutes)
  2. Add a Railway volume mounted at /data for snapshot persistence
  3. Set DFLY_requirepass to a strong password to protect the instance
  4. Connect your app: point any Redis client at the Dragonfly service's private host on port 6379
  5. Use ${{Dragonfly.RAILWAY_PRIVATE_DOMAIN}}:6379 as the connection host from other Railway services

No cluster setup. No sharding config. No code changes to your app.


Common Use Cases

  • Drop-in Redis replacement without code changes — Dragonfly speaks the Redis wire protocol; change your connection string and your existing clients, libraries, and CLI work unchanged
  • High-throughput cache for your app — session storage, API response caching, and rate limiting at millions of ops/sec on a single instance instead of a Redis cluster
  • Redis alternative after the license changes — teams moving off Redis 8's AGPLv3 or avoiding cluster complexity adopt Dragonfly for the same API at higher performance
  • Memcached replacement — Dragonfly is Memcached-API compatible too, so it can consolidate both your Redis and Memcached workloads onto one datastore
  • Job queue and message broker backend — back BullMQ, Celery, Sidekiq, or any Redis-based queue with Dragonfly for higher throughput without cluster overhead
  • Feature store and real-time analytics — low, sub-millisecond latency for ML feature stores, and real-time counters on large in-memory datasets

Configuration

VariableRequiredDescription
DFLY_requirepass✅ RecommendedPassword clients must supply to connect — set before exposing the instance
DFLY_dirPre-setSnapshot directory — /data, backed by the persistent volume
DFLY_dbfilenameOptionalSnapshot filename for persistence — e.g. dump
DFLY_snapshot_cronOptionalCron expression for automatic snapshots — e.g. */5 * * * * for every 5 minutes
DFLY_maxmemoryOptionalMemory limit for the datastore — e.g. 2gb
DFLY_cache_modeOptionalSet to true for LRU cache-eviction behaviour like Memcached
PORTAuto-setRailway injects the port; Dragonfly listens on 6379

Dragonfly does not persist to disk by default — it's in-memory first. Set DFLY_dbfilename and DFLY_snapshot_cron with a mounted /data volume to enable periodic snapshots so your data survives restarts and redeploys.


Dragonfly vs. Alternatives

Dragonfly (Railway)RedisValkeyMemcached
Architecture✅ Multi-threaded❌ Single-threaded❌ Single-threaded✅ Multi-threaded
Throughput (single node)✅ Up to 25x RedisBaseline~RedisHigh (cache only)
Scales without a cluster✅ Vertical, all cores❌ Needs cluster❌ Needs cluster⚠️ Limited
Redis API compatible✅ Drop-in✅ Native✅ Native❌ No
Memcached API compatible✅ Yes❌ No❌ No✅ Native
Memory efficiency✅ Up to 40% lessBaseline~RedisCache only
Snapshot without memory spike✅ No fork❌ 3x spike on BGSAVE❌ Fork-basedN/A
Data structures✅ Strings, sets, JSON, streams✅ Full✅ Full⚠️ Key-value only
LicenseBSL 1.1 → Apache 2.0AGPLv3 (v8)BSDBSD

Dependencies for Dragonfly Hosting

  • Railway account — Hobby plan (~$5/month) for a Dragonfly instance and volume
  • A persistent volume mounted at /data if you need snapshot persistence
  • Any Redis or Memcached client library — no Dragonfly-specific SDK required

Deployment Dependencies

Implementation Details

This template deploys the official Dragonfly image over Railway's private network on port 6379 with a persistent volume at /data. Dragonfly's multi-threaded, shared-nothing engine uses all CPU cores allocated to the Railway service — scaling throughput is a matter of scaling the instance's resources, not adding cluster nodes.

Connect from other Railway services using the private domain reference: ${{Dragonfly.RAILWAY_PRIVATE_DOMAIN}}:6379. Dragonfly is in-memory first; enable snapshotting with DFLY_dbfilename and DFLY_snapshot_cron so data periodically flushes to the /data volume. Because Dragonfly snapshots without forking, it doesn't spike memory during saves the way Redis BGSAVE does — a meaningful advantage on write-heavy, memory-constrained instances.


Frequently Asked Questions

Can Dragonfly really replace Redis without code changes? Yes, in most scenarios. Dragonfly is compatible with the Redis (RESP) wire protocol and supports 240+ of the most common Redis commands, plus Memcached and Valkey APIs. Point your existing Redis client at the Dragonfly host and port, update credentials, and your app runs unchanged. A few advanced features — Redis Modules like RedisGraph, and some cluster-specific edge behaviours — are not supported.

How is Dragonfly faster than Redis? Redis processes commands on a single thread, so it becomes CPU-bound as traffic scales and needs a cluster to grow. Dragonfly uses a multi-threaded, shared-nothing architecture where each thread owns a slice of the keyspace with no locks — so it scales vertically across all CPU cores on one instance, reaching up to 25x Redis throughput (millions of QPS) without a cluster.

Does Dragonfly save data to disk? Dragonfly is in-memory first and does not persist by default. Enable snapshots by setting DFLY_dbfilename and DFLY_snapshot_cron with a mounted /data volume. Unlike Redis BGSAVE, Dragonfly's snapshotting doesn't fork the process, so memory usage stays stable during saves.

What is the Dragonfly license — can I use it commercially? Dragonfly is BSL 1.1, which converts to Apache 2.0 after four years. For self-use — caching, queues, feature stores in your own app — it's completely free. The only restriction is you can't run a managed Dragonfly service competing with the official Dragonfly Cloud.

Do I lose my data if Railway redeploys? Only if you haven't enabled snapshots. With DFLY_snapshot_cron and a /data volume, Dragonfly periodically writes snapshots that survive redeploys and restarts. For pure caching workloads where data is disposable, you can run without persistence for maximum speed.

Is Dragonfly a good fit if I use Redis Cluster or Redis Modules? Dragonfly focuses on single-instance vertical scaling rather than clustering. If your architecture requires Redis Cluster or modules like RedisSearch/RedisGraph, audit compatibility first. For most caching, session, and queue workloads, one Dragonfly instance replaces a Redis cluster outright.


Why Deploy and Host Dragonfly on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Dragonfly on Railway, you get a Redis- and Memcached-compatible in-memory datastore with up to 25x the throughput and up to 80% lower resource cost — a single instance that replaces a Redis cluster, with snapshot persistence and private networking, at ~$5/month flat.


Template Content

More templates in this category

View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
8
View Template
Postgres Backup to Cloudflare R2 (S3-Compatible)
Automated PostgreSQL backups to S3-compatible storage with encryption

Artour
7
View Template
ReadySet
A lightweight caching engine for Postgres

Milo
34