Profile Queries¶
After connecting your app to ReadySet, profile your app performance and identify queries to cache in ReadySet. Generally, it's best to focus on frequent queries that are too slow and/or that are putting unwanted load on your upstream database.
If you already have performance monitoring in place, use that tooling to identify queries that can benefit from caching in ReadySet. Otherwise, you can use ReadySet's own metrics endpoint to profile queries.
Enable ReadySet metrics¶
To enable ReadySet metrics, start ReadySet with the following options:
To include query-specific execution metrics, also pass:
Access ReadySet metrics¶
You can access ReadySet metrics at <metrics address>/metrics
, where the metrics address is defined by the --metrics-address
option (default: 0.0.0.0:6034/metrics
).
Tip
When running ReadySet locally, you can usually access ReadySet metrics at https://127.0.0.1:6034/metrics
in your browser.
Examine per-query metrics¶
ReadySet metrics are formatted for easy integration with Prometheus. However, the quickest way to examine per-query metrics is to use a simple metrics utility written in Python that queries the metrics endpoint and displays latencies for queries received by ReadySet.
-
Download the metrics utility and its
requirements.txt
: -
Install dependencies for the utility:
-
Set the
HOST
environment variable to the IP address/hostname portion of--metrics-address
: -
Run the script with
You can filter the output of this script to show only queries displayed in
SHOW PROXIED QUERIES
orSHOW CACHES
by passing the--filter-queries
flag and piping the output of those ReadySet commands into the script like so: