Readyset — Transparent Cache untuk Postgres
Dokumentasi ringkas Readyset: cache SQL wire-compatible untuk Postgres/MySQL dengan invalidasi otomatis via replication stream.
#PostgreSQL#Performance#Caching#Architecture
Apa itu Readyset?
Readyset adalah transparent database cache untuk PostgreSQL dan MySQL. Memberikan performa mirip in-memory key-value store tanpa rewrite aplikasi dan tanpa invalidasi cache manual.
Sumber: readysettech/readyset · Docs: docs.readyset.io
Ide inti
Aplikasi → Readyset → PostgreSQL / MySQL
(wire-compatible)
- Siap di antara aplikasi dan database
- Query
SELECTkompleks diubah menjadi lookup cepat - Hasil cache tetap sinkron lewat replication stream database
- Kompatibel dengan ORM / client yang sudah ada (wire protocol)
Mengapa beda dari Redis cache manual?
| Aspek | Cache app (Redis) | Readyset |
|---|---|---|
| Perubahan kode | Sering perlu | Minimal / transparent |
| Invalidasi | Manual / mudah salah | Otomatis via replication |
| Query complex JOIN | Sulit di-cache utuh | Bisa di-cache sebagai hasil query |
| Wire protocol | Bukan SQL proxy | Postgres/MySQL compatible |
Quickstart
bash -c "$(curl -sSL https://launch.readyset.io)"
Opsi lain:
Kapan cocok dipakai?
- Read-heavy workload di Postgres
- Query mahal (JOIN, agregasi) yang sering diulang
- Ingin scale read throughput tanpa memecah DB dulu
- Tim ingin hindari kompleksitas cache invalidation di application layer
Kapan hati-hati?
- Write path tetap ke primary DB — Readyset mempercepat read cacheable
- Butuh memahami query mana yang di-cache vs bypass
- Operasional: proses tambahan di depan Postgres (monitoring, failover, lag replication)
- Bukan pengganti desain skema yang buruk — optimasi dasar tetap penting
Alur mental engineer
- Ukur query lambat (
pg_stat_statements,EXPLAIN ANALYZE) - Optimasi index/query di Postgres dulu
- Jika masih bottleneck di read berulang → evaluasi Readyset
- Cache query paling mahal & paling sering
- Monitor hit rate, lag, dan memory
Tautan berguna
- Interactive demo: https://docs.readyset.io/demo
- Why Readyset: https://blog.readyset.io/dont-use-kv-stores/
- Blog: https://blog.readyset.io
- Community Slack: lihat README repo
Ringkas
Readyset = SQL cache proxy yang menjaga konsistensi lewat replication, cocok untuk scale read tanpa rewrite app — tetap sejalan dengan filosofi “Postgres first, add pieces when needed”.