How to check KV latency issues in Couchbase

Hi @lakshram24
I’ll assume here that you’re looking to measure the latency of KV operations you’re making from your application, rather than the KV operations being executed from e.g. query. And I’ll assume you want full end-to-end latency including the network, e.g. you want them captured from the application side.

Yes you have a few options to see get latency info.

One way is of course just to measure how long each op takes, using your application logic, and write to logs or similar.

Then you have the SDK’s Metrics Reporting | Couchbase Docs. This will periodically (every 10 minutes by default) output into your application logs an aggregated view of how long all operations over the last window have taken.

Both of those are a great starting point. If you’re willing to setup an external consumer, then you can do more sophisticated things with tracing and metrics, and get excellent insight - I would recommend these for any deployment.

For instance, we have good integration on the SDK side with OpenTelemetry and other tracing providers like OpenTracing and Micrometer. As mentioned there is a little more work needed to set these up (need to have a tracing consumer such as Jaeger or Honeycomb), but once going they provide excellent information. For instance they can show you a detailed view of every operation sent from the SDK, including time spent in individual stages.

And the SDKs have similar integrations with metrics - e.g. you can export to Prometheus or other metrics consumers if desired. The metrics include the latencies of all operations. Again it’s a little more initial work, but the SDK docs show how to spin up Prometheus in a Docker container and export to it - it can be up and running in a few minutes.

See Request Tracing | Couchbase Docs for further info on the tracing, and Metrics Reporting | Couchbase Docs for the metrics.

1 Like