← Semua picks

Stack Comparison Conditional

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.

25 Juni 2026 · 10 menit ·Use case: Cache + queue store untuk SaaS Indonesia 2026
RedisMemcachedDragonfly

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)

StoreSingle-threadMulti-thread (4 core)
Redis 7.495K95K (single-thread by design)
Memcached 1.6280K850K
Dragonfly 1.20420K1.6M

Dragonfly multi-threaded = clear winner. Memcached close second. Redis single-threaded bottleneck.

Latency p99 (operations under load)

Storep99 latency
Redis1.8ms
Memcached0.6ms
Dragonfly0.5ms

Memcached + Dragonfly menang latency. Redis acceptable.

Memory efficiency (1M key-value)

StoreMemory used
Redis145 MB
Memcached95 MB
Dragonfly48 MB

Dragonfly paling efisien (intelligent encoding + dictionary compression).

Persistence

StoreRDB snapshotAOFHybrid
RedisYesYesYes
MemcachedNo (in-memory only)NoNo
DragonflyYes (snapshot fast)LimitedYes

Memcached pure in-memory — restart = data hilang. OK untuk cache, not for queue/state.

Feature comparison

FeatureRedisMemcachedDragonfly
Data structuresString, list, hash, set, sorted set, stream, HLLString onlyFull Redis compat
Pub/SubYesNoYes
StreamsYesNoYes
PersistenceRDB + AOFNoSnapshot + AOF (limited)
ReplicationYes (async, semi-sync)No (memcached cluster)Yes
Cluster modeYes (Redis Cluster)Yes (consistent hash)Yes
LUA scriptingYesNoLimited
Multi-threadingNo (Redis 7+ I/O thread only)YesYes (full)
Memory efficiencyBaseline2-3x better3x better
Redis protocolNativeNoNative (drop-in)
ModulesRedisJSON, RediSearch, RedisGraphNoNo (workaround)
LicenseRSAL/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 caseRecommended
Pure hot cache (session, computed result)Memcached atau Dragonfly
Queue + worker (BullMQ, Sidekiq)Redis atau Dragonfly
Pub/sub messagingRedis atau Dragonfly
Rate limitingRedis atau Dragonfly (data structure)
Distributed lockRedis atau Dragonfly
Real-time leaderboard (sorted set)Redis atau Dragonfly
Stream processingRedis Streams atau Dragonfly
Full-text search di cacheRedis (RediSearch) — Dragonfly limited
Document store di cacheRedis (RedisJSON) — Dragonfly limited
New project performance criticalDragonfly
Self-host budget tightDragonfly (memory efficient)
Legacy migrationStay Redis (compat)
WordPress object cacheMemcached

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

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

// Pick Stack Comparison lain


← Semua picks RSS feed