A
PostgreSQL

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 SELECT kompleks 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

  1. Ukur query lambat (pg_stat_statements, EXPLAIN ANALYZE)
  2. Optimasi index/query di Postgres dulu
  3. Jika masih bottleneck di read berulang → evaluasi Readyset
  4. Cache query paling mahal & paling sering
  5. Monitor hit rate, lag, dan memory

Tautan berguna

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”.