Monitoring Redis instances

This page describes how to monitor your Cloud Memorystore for Redis instance's performance.

Monitoring allows you to check in on your instances to make sure they're behaving as desired. This guide covers a few basic examples of monitoring Redis instances. In addition to the types of monitoring covered here, Cloud Memorystore for Redis is compatible with open source Redis, so you can use existing Redis monitoring tools from Compute Engine VMs to monitor your instances.

Monitoring instances in the Google Cloud Platform Console

To view an instance's core metrics:

  1. Go to the Cloud Memorystore page in the Google Cloud Platform Console.
    Cloud Memorystore
  2. Click the Instance ID of the instance you'd like to view.

You can monitor several metrics by visiting an instance's Instance details page in the Google Cloud Platform Console. By default, the graph shows the instance's current memory usage and its max capacity. Other metrics available in the GCP Console are: evicted keys/expired keys, instance uptime, connected clients/blocked clients, and network bytes in/out.

To change the metrics shown on the graph, use the dropdown in its upper left corner. To change the time frame, select a different period of time in the upper right corner of the graph.

Monitoring instances with Stackdriver

Stackdriver Monitoring is a monitoring service that allows you to view metrics such as uptime for your Redis instances. For more details about all Cloud Memorystore for Redis metrics available from Stackdriver Monitoring, see the Monitoring reference documentation.

Signing up for Stackdriver

If you're not using Stackdriver Monitoring, create a Monitoring Workspace:

  1. From to the GCP Console, go to Monitoring.

    Go to Monitoring

  2. If the Add your project to a Workspace dialog is displayed, create a new Workspace by selecting your GCP project under New Workspace and then clicking Add. In the following image, the GCP project name is Quickstart:

    Creating a new workspace dialog.

    The Add your project to a Workspace dialog is displayed only when you have at least one existing Workspace available to you. The Workspaces listed under Existing Workspace are Workspaces you've created or Workspaces for GCP projects where you have editorial permission. Using this dialog, you can choose between creating a new Workspace and adding your project to an existing Workspace.

For pricing information, see Stackdriver pricing.

Viewing instance uptime, restart, and failover information in Stackdriver

  1. To view instance uptime information, go to the Metrics Explorer.

    Go to Metrics Explorer

  2. If prompted, log in, then navigate to the project with your Redis instances. Click the button again to be taken directly to Redis's uptime metrics. You can also navigate to the uptime metrics by clicking Resources > Metrics Explorer and then selecting redis_instance as the resource type and redis/server/uptime as the metric.

Your graph looks something like this:

Graph of instance uptime

  • Each line indicates a single instance.
  • Up and to the right indicates Redis is up.
  • A drop off indicates a restart.
  • Missing data indicates unavailability.
  • Below your graph, there's a color-coded key that indicates which line belongs to which instance. As you hover over the key, the corresponding line on the graph is highlighted.

For Standard Tier instances, there will be two entries with the same name but different colors in the key below the graph. The master instance is the line with the highest uptime. You can identify a failover by looking for a spot on the graph where the master instance's line drops off to zero and the replica's line continues to rise, indicating it has become the new master instance.

You can change the time horizon in the upper-right hand corner as well as add filters to tailor the information you're seeing to a particular region, project, instance, or replica.

Viewing operations per second

  1. To view an instance's operations per second, go to Metrics Explorer.

    Go to Metrics Explorer

    If prompted, log in and navigate to the project with your Redis instances. You can then click the link again to be taken directly to the operations per second metric or you can navigate to the metric directly:

  2. Click Resources > Metrics Explorer.

  3. Select Redis instance as the resource type.

  4. Select Calls as the desired metric.

  5. Choose Sum from the aggregation drop-down menu.

Calls is a metric surfaced by Cloud Memorystore for Redis that mimics the Redis instantaneous_ops_per_sec metric when you set the aggregation to sum.

Monitoring your instance's memory usage

You can monitor how much available memory you have in your Redis instance with a Stackdriver dashboard. You can also set a Stackdriver alert to notify you when your Redis memory reaches a customizable threshold.

Creating a dashboard to monitor Redis memory usage

  1. Go to the Stackdriver Create Dashboard page:

    Go to create custom dashboard

  2. Click Add Chart.

    1. Provide a name for the chart. For example, "Redis Memory Usage".

    2. In the search box labeled Find resource type and metric, search for "Cloud Memorystore Redis Instance", and select it.

      1. Enter Maximum Memory as the metric type.
        1. In the Filter box, add a filter for instance_id and select the instance you want to monitor.
        2. If you want to monitor the usage of all the Cloud Memorystore instances in your project, use "Group by" and select instance_id.
        3. Under Aggregation, set the Aligner and Reducer to Max.
    3. Click Add Metric, search for "Used Memory", and select it.

      1. In the Filter box, add a filter for instance_id and select the instance you want to monitor.
      2. If you want to monitor the usage of all the Cloud Memorystore instances in your project, use Group by and select instance_id.
      3. Under Aggregation, set the Aligner and Reducer to Max.
  3. Click Save. You can access this dashboard from the menu by hovering over Dashboards.

Setting a Stackdriver alert for memory usage

You can set an alert in Stackdriver to notify you if the Used Memory metric exceeds a threshold that you set.

To create an alert for the Used Memory metric:

  1. Go to the Create New Alerting Policy page in Stackdriver:

    Go to Create alerting policy

  2. Add a condition for Used Memory threshold:

    1. Click Add Condition.
    2. Provide a name for the condition, for example "Used Memory Alert".
    3. Under Target, select Cloud Memorystore Redis instance resource type.
      1. For the Metric, select "Used Memory".
    4. Under Configuration, choose Any time the series violates.
    5. Set Condition to Is above.
    6. Set Threshold to the equivalent, in bytes, of 50% of your instance size.
      1. When your memory usage exceeds 50%, you should regularly monitor your memory usage and consider scaling up the instance if your memory usage rises dramatically.
    7. Set For to 1 minute initially to understand the usage pattern; you can increase this threshold to a higher number as the usage stabilizes.
    8. Click Save.
  3. Set the appropriate notification channel.

  4. Name the policy (for example "Redis memory usage alert")

  5. Click Save.

You are now notified anytime the threshold is violated.

  1. Click Save. You can access this dashboard from the menu by hovering over Dashboards.

Setting a Stackdriver alert for system memory usage ratio

You should set an alert in Stackdriver to notify you if the system memory usage ratio metric exceeds 80%.

To create an alert for the system memory usage ratio metric:

  1. Go to the Create New Alerting Policy page in Stackdriver:
    Create Policy
  2. Add a condition for the system memory usage ratio threshold:
    1. Click Add Condition.
    2. Provide a name for the condition, for example "System Memory Usage Ratio Alert".
    3. Under Target, select Cloud Memorystore Redis instance resource type.
      1. For the Metric, select "System Memory Usage Ratio".
    4. Under Configuration, choose Any time the series violates.
    5. Set Condition to Is above.
    6. Set Threshold to 0.8, which represents 80% of your system memory.
      1. When your system memory usage exceeds 80%, follow the best practices for Managing your system memory usage ratio.
    7. Optionally, use the Filter field to set an alert for a single instance ID. If you choose not to filter to a specific instance, the alert will notify you any time a Cloud Memorystore for Redis instance in your project has a system memory usage ratio exceeding 80%.
    8. Click Save.
  3. Set the appropriate notification channel.
  4. Name the policy.
  5. Click Save.

You are now notified anytime the system memory usage ratio exceeds 80%.

Viewing Redis logs

Redis produces logs that Stackdriver Logging captures.

Viewing audit logs

  1. Go to the Logs Viewer page in the GCP Console.

    Logs Viewer

  2. To view the audit logs, select Audited Resource > redis.googleapis.com from the resources drop-down, as shown below:

    Logs viewer screen shot

Viewing activity logs

  1. Go to the Logs Viewer page in the GCP Console.

    Logs Viewer

  2. To view the activity logs, select Cloud Memorystore Redis instance from the resources drop-down.

Was this page helpful? Let us know how we did:

Send feedback about...

Google Cloud Memorystore for Redis