Redis vs Memcached vs Dragonfly 2026
Tiga in-memory store untuk cache/queue. Saya pakai Redis 36 bulan, Memcached 18 bulan, Dragonfly 12 bulan production. Verdict tergantung workload + budget.
TL;DR
- Redis: Matang, feature-rich, default safe. Conditional Recommend untuk most workload.
- Memcached: Simple, pure key-value cache. Conditional Recommend untuk hot cache simple.
- Dragonfly: Drop-in Redis, 3-8x throughput, memory efficient. Conditional Recommend untuk performance.
- Verdict: Dragonfly default untuk new project (Redis compat + better perf). Redis stay jika legacy. Memcached niche.
Konteks
Saya pakai ketiga in-memory store di 14 project SMB Indonesia 2022-2026:
- Redis (10 project): SaaS dental, HR SaaS, ecommerce, admin panel — sebagian besar pakai Redis untuk cache + queue + session
- Memcached (3 project): klien legacy WordPress + WooCommerce (object cache), 1 SaaS dengan pure hot cache
- Dragonfly (3 project): klien yang migrate dari Redis Q1-Q2 2026 untuk performance + memory saving
Total 36 bulan compare.
Pricing (Juni 2026)
Self-host VPS
Semua tiga gratis install di VPS:
- VPS Niagahoster Cloud 2GB RAM: Rp 150rb/bulan (cukup untuk cache SaaS 5-10K user)
- VPS Biznet 4GB RAM: Rp 350rb/bulan (cukup untuk 10-30K user)
Managed services
Redis:
- Upstash Redis: $0.20/100K request, free tier 10K request/hari
- Redis Cloud: $7-200+/mo tergantung RAM
- Aiven Redis: $19+/mo
Memcached:
- Memcached Cloud (Redis Inc): $7-200+/mo (same as Redis Cloud)
- AWS ElastiCache Memcached: $13+/mo
Dragonfly:
- Dragonfly Cloud: $25+/mo (similar Redis pricing)
- Self-host paling popular karena lebih efisien
Cost untuk SaaS 5K MAU
- Self-host (any): Rp 150-350rb/bulan VPS
- Upstash Redis: Rp 100-400rb/bulan
- Managed Redis Cloud: Rp 250rb-1 juta/bulan
Self-host paling hemat untuk Indonesia (VPS lokal latency excellent).
Performance benchmark
Test: VPS Biznet 4GB RAM, 4 vCPU. Workload: 50/50 GET/SET, 1KB value.
Throughput (ops/sec)
| Store | Single-thread | Multi-thread (4 core) |
|---|---|---|
| Redis 7.4 | 95K | 95K (single-thread by design) |
| Memcached 1.6 | 280K | 850K |
| Dragonfly 1.20 | 420K | 1.6M |
Dragonfly multi-threaded = clear winner. Memcached close second. Redis single-threaded bottleneck.
Latency p99 (operations under load)
| Store | p99 latency |
|---|---|
| Redis | 1.8ms |
| Memcached | 0.6ms |
| Dragonfly | 0.5ms |
Memcached + Dragonfly menang latency. Redis acceptable.
Memory efficiency (1M key-value)
| Store | Memory used |
|---|---|
| Redis | 145 MB |
| Memcached | 95 MB |
| Dragonfly | 48 MB |
Dragonfly paling efisien (intelligent encoding + dictionary compression).
Persistence
| Store | RDB snapshot | AOF | Hybrid |
|---|---|---|---|
| Redis | Yes | Yes | Yes |
| Memcached | No (in-memory only) | No | No |
| Dragonfly | Yes (snapshot fast) | Limited | Yes |
Memcached pure in-memory — restart = data hilang. OK untuk cache, not for queue/state.
Feature comparison
| Feature | Redis | Memcached | Dragonfly |
|---|---|---|---|
| Data structures | String, list, hash, set, sorted set, stream, HLL | String only | Full Redis compat |
| Pub/Sub | Yes | No | Yes |
| Streams | Yes | No | Yes |
| Persistence | RDB + AOF | No | Snapshot + AOF (limited) |
| Replication | Yes (async, semi-sync) | No (memcached cluster) | Yes |
| Cluster mode | Yes (Redis Cluster) | Yes (consistent hash) | Yes |
| LUA scripting | Yes | No | Limited |
| Multi-threading | No (Redis 7+ I/O thread only) | Yes | Yes (full) |
| Memory efficiency | Baseline | 2-3x better | 3x better |
| Redis protocol | Native | No | Native (drop-in) |
| Modules | RedisJSON, RediSearch, RedisGraph | No | No (workaround) |
| License | RSAL/SSPL (Redis 7.4+) | BSD (full open) | BSL (similar Redis) |
Trade-off
Redis
Pro: Matang — 15+ tahun production, ekosistem terbesar. Data structure rich — list + sorted set + stream untuk queue dan time-series. Pub/Sub built-in. Modules ekosistem (RedisJSON untuk document store, RediSearch untuk full-text). Documentation paling lengkap.
Con: Single-threaded — throughput bottleneck di high-load. Memory consumption higher dari alternative. License changed (RSAL/SSPL sejak 7.4) — concern untuk strict open-source requirement.
Memcached
Pro: Simple — setup 5 menit, zero tuning untuk most. Multi-threaded native — throughput excellent per core. Memory efficient untuk pure cache. License BSD (full open). Lightweight (binary kecil, RAM minimum).
Con: Pure key-value — no data structure. No persistence — restart = data hilang. No pub/sub. Limited untuk queue / state. Ekosistem tooling lebih kecil.
Dragonfly
Pro: Drop-in Redis — semua client library work. Multi-threaded — 4-25x throughput Redis. Memory efficient 3x. Snapshot persistence fast. Modern codebase (Rust + C++). Active development.
Con: Ekosistem newer — community lebih kecil. Beberapa Redis Module tidak support. License BSL (similar Redis post-2024) — bukan full open-source. Documentation OK tapi tidak as polished as Redis.
Use case decision matrix
| Use case | Recommended |
|---|---|
| Pure hot cache (session, computed result) | Memcached atau Dragonfly |
| Queue + worker (BullMQ, Sidekiq) | Redis atau Dragonfly |
| Pub/sub messaging | Redis atau Dragonfly |
| Rate limiting | Redis atau Dragonfly (data structure) |
| Distributed lock | Redis atau Dragonfly |
| Real-time leaderboard (sorted set) | Redis atau Dragonfly |
| Stream processing | Redis Streams atau Dragonfly |
| Full-text search di cache | Redis (RediSearch) — Dragonfly limited |
| Document store di cache | Redis (RedisJSON) — Dragonfly limited |
| New project performance critical | Dragonfly |
| Self-host budget tight | Dragonfly (memory efficient) |
| Legacy migration | Stay Redis (compat) |
| WordPress object cache | Memcached |
Konteks Indonesia
SaaS dental Jakarta (Redis self-host VPS): queue untuk send reminder SMS + email. Session store untuk staff klinik. Rate limiting API. VPS Biznet 2GB RAM Rp 250rb/bulan. Maintenance 15 menit/bulan.
HR SaaS Jakarta (Dragonfly migrate dari Redis 2026): 8K user, cache employee record + payroll computation. Migration Redis → Dragonfly: 1 hari effort (zero code change). Memory before: 1.2GB, after: 400MB. VPS dapat downgrade 4GB → 2GB = saving Rp 100rb/bulan. Throughput naik 4x — DB read load turun karena cache hit rate naik.
WordPress klinik kecantikan (Memcached + W3 Total Cache): object cache untuk page render speedup. VPS Niagahoster Rp 80rb/bulan. Setup 30 menit. Page load 2.8s → 0.9s after cache.
Setup tips Indonesia
Dragonfly di VPS (15 menit)
# Ubuntu/Debian
wget https://github.com/dragonflydb/dragonfly/releases/latest/download/dragonfly_amd64.deb
sudo dpkg -i dragonfly_amd64.deb
sudo systemctl enable --now dragonfly
# Check
redis-cli ping
# PONG
Config /etc/dragonfly/dragonfly.conf:
--bind=127.0.0.1
--port=6379
--requirepass=YOUR_PASSWORD
--maxmemory=1.5gb
--dir=/var/lib/dragonfly
--logtostderr
Redis di VPS (15 menit)
sudo apt install redis-server
# Edit /etc/redis/redis.conf
# bind 127.0.0.1
# requirepass YOUR_PASSWORD
# maxmemory 1.5gb
# maxmemory-policy allkeys-lru
sudo systemctl restart redis-server
Memcached di VPS (5 menit)
sudo apt install memcached
# Edit /etc/memcached.conf
# -m 1024 (memory MB)
# -l 127.0.0.1
sudo systemctl restart memcached
Migration paths
Redis → Dragonfly (recommended migration 2026)
Effort: 30 menit - 2 jam tergantung complexity.
# 1. Backup Redis
redis-cli --rdb /tmp/backup.rdb
# 2. Install Dragonfly (replace Redis)
sudo systemctl stop redis-server
sudo apt remove redis-server
# Install Dragonfly (see above)
# 3. Restore data
cp /tmp/backup.rdb /var/lib/dragonfly/dump.rdb
sudo systemctl restart dragonfly
# 4. Update app config (jika port beda)
# Most case: port 6379 sama, no app change
# 5. Test
redis-cli ping
Verify: client library (ioredis, node-redis, etc) work tanpa change.
Memcached → Redis/Dragonfly
Effort: 4-12 jam (refactor client library + cache key pattern). Worth jika butuh feature beyond key-value.
Cloud → Self-host
Effort: 2-6 jam. Worth jika bill cloud > Rp 500rb/bulan dan VPS skill available.
Gotcha (lesson learned)
1. Eviction policy
Default Redis: no eviction (OOM kalau penuh). Set explicit:
maxmemory-policy allkeys-lru # untuk cache
# atau
maxmemory-policy noeviction # untuk queue (jangan kehilangan data)
Memcached: default LRU (no choice). Dragonfly: similar Redis config.
2. Persistence trade-off
Redis RDB: snapshot periodik (data loss possible between snapshot). AOF: append-only log (lebih durable, lebih lambat). Pick based on data importance.
Memcached: no persistence — design app to handle cache miss.
3. Connection pooling
Tanpa pool: setiap request open connection — overhead besar. Pakai connection pool di client library:
import { Redis } from 'ioredis';
const redis = new Redis({
host: 'localhost',
port: 6379,
maxRetriesPerRequest: 3,
enableOfflineQueue: false,
});
// ioredis manage pool internal
4. Memory monitor
Set alert untuk memory usage > 80%. OOM = service crash atau evict aggressive (data loss).
redis-cli INFO memory
5. Bind localhost di VPS
Default bind 0.0.0.0 = exposed ke public internet. WAJIB bind 127.0.0.1 atau internal network only. Plus set password.
Yang surprising
Dragonfly adoption Indonesia tumbuh cepat 2026. 3 dari 5 klien saya yang butuh Redis-like di 2026 default Dragonfly. Migration smooth.
Memcached masih sweet spot untuk WordPress. WordPress + W3 Total Cache + Memcached = saving 60-80% server load untuk site high traffic. Setup 30 menit, no maintenance.
Redis license change 2024 (RSAL) mostly tidak impact SMB Indonesia. Tapi untuk klien yang ketat strict open-source: Dragonfly (BSL serupa) atau fork Valkey (BSD) jadi alternatif.
Verdict
Conditional Recommend untuk ketiga:
Pakai Dragonfly jika:
- New project 2026
- Performance critical (high throughput)
- Memory efficiency penting
- Redis compat dibutuhkan
- Self-host VPS budget tight
Pakai Redis jika:
- Legacy project (compat)
- Butuh Redis Module (RedisJSON, RediSearch)
- Ekosistem tooling matang priority
- Tim deep Redis workflow
Pakai Memcached jika:
- Pure hot cache simple (session, page render)
- WordPress + plugin caching
- Setup minimal priority
- License BSD strict requirement
Skip jika: workload Anda cukup di-cover oleh DB cache (Postgres shared_buffers + query cache) atau CDN edge cache. Untuk SaaS Indonesia simple (< 1K MAU): in-memory cache external bisa overkill.
Untuk DB comparison: Postgres vs MySQL vs MariaDB. Untuk real-time alternative: Bundle Real-Time Pusher vs PartyKit vs Supabase.
Ditulis oleh Asti Larasati