Databases 7 min read

Boost Real‑Time App Performance with ReadySet: A Hands‑On Guide to SQL Caching

This article introduces ReadySet, an open‑source SQL caching layer for MySQL and PostgreSQL, explains its architecture and advantages, and provides step‑by‑step instructions for installing the Docker image, configuring connections, creating caches, and testing query performance to achieve millisecond‑level response times.

dbaplus Community
dbaplus Community
dbaplus Community
Boost Real‑Time App Performance with ReadySet: A Hands‑On Guide to SQL Caching

Introduction

ReadySet is an open‑source SQL cache engine that sits between an application and the database, supporting MySQL and PostgreSQL. It aims to accelerate real‑time applications by caching complex queries without requiring code changes or database migration.

Architecture

ReadySet operates as a proxy layer (Java/PHP application → ReadySet → MySQL) and is implemented as a lightweight in‑memory cache. It provides the same interface as Redis or Memcached but works with standard SQL.

ReadySet cache architecture diagram
ReadySet cache architecture diagram

How ReadySet Works

Read operations

Send the SQL query directly to ReadySet.

If the result is cached, ReadySet returns it instantly, achieving millisecond‑level latency.

If not cached, ReadySet forwards the request to the backend database, caches the result, and returns it.

Write operations (INSERT, UPDATE, DELETE)

ReadySet forwards the write request to the backend database and updates the cache accordingly.

Advantages

Uses standard SQL; no new query language to learn.

No code changes required; only the database connection string needs to be updated.

Supports high‑speed caching of complex SQL queries.

Automatically keeps the cache consistent with the database.

Allows selective caching of high‑frequency queries to optimize resource usage.

This design makes ReadySet especially suitable for read‑intensive workloads, delivering significant query‑performance gains while preserving simplicity and eventual consistency.

Installation and Usage

1. Pull the ReadySet Docker image shell> docker pull readysettech/readyset 2. Run the ReadySet service

shell> docker run -d -p 3307:3307 -p 6034:6034 \
    --name readyset \
    -e UPSTREAM_DB_URL=mysql://admin:[email protected]:6666/test \
    -e LISTEN_ADDRESS=0.0.0.0:3307 \
    readysettech/readyset:latest

Note: The UPSTREAM_DB_URL must contain the backend MySQL credentials, host, port, and database name with ALL privileges.

ReadySet exposes two ports: 3307 for query traffic and 6034 for metrics (/metrics endpoint).

After starting, ReadySet connects to the database and replicates the specified tables, which may take seconds to hours depending on size and network conditions.

Check replication status with: shell> docker logs readyset When you see INFO replicators::noria_adapter: MySQL connected, the system is ready to cache queries.

You can also query the status via MySQL client:

ReadySet snapshot status
ReadySet snapshot status

When the Snapshot Status column shows Completed, ReadySet is ready.

3. Cache a query

Connect to ReadySet on port 3307 with a MySQL client and run the slow query, then execute: SHOW PROXIED QUERIES; Check the readyset supported column; a value of Yes means the query can be cached.

4. Create a SQL cache CREATE CACHE FROM <query_id>; Example: mysql> CREATE CACHE FROM q_4c1cf3b8080fe634; 5. View cached queries

SHOW CACHES;
ReadySet cached queries
ReadySet cached queries

6. Test performance

Run the cached slow SQL against ReadySet (port 3307) and directly against the backend MySQL. The ReadySet execution should return results in seconds, demonstrating the cache’s effectiveness after the first execution.

Initial tests show that ReadySet’s caching becomes noticeable immediately after the first query, providing substantial latency reduction.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerdatabasemysqlPostgreSQLReadySetSQL Caching
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.