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 Console

To view an instance's core metrics:

  1. Go to the Cloud Memorystore for Redis page in the Google Cloud Console.
    Cloud Memorystore for Redis
  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 Console. By default, the graph shows the instance's current memory usage and its max capacity. Other metrics available in the Cloud 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 Cloud 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 Google Cloud project under New Workspace and then clicking Add. In the following image, the Google Cloud 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 Google Cloud 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

To view instance uptime information, use Metrics Explorer:

  1. Go to the Google Cloud Console, login and navigate to the project with your Redis instances:

    Go to Cloud Console

  2. Select Monitoring from the left navigation menu.

  3. In Monitoring, if the navigation pane isn't expanded, click Expand . This button is located on the lower left of the console.

  4. If Metrics Explorer is shown in the navigation pane, click Metrics Explorer. Otherwise, select Resources and then select Metrics Explorer.

  5. Select 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

To view an instance's operations per second, use Metrics Explorer:

  1. Go to the Google Cloud Console, login and navigate to the project with your Redis instances:

    Go to Cloud Console

  2. Select Monitoring from the left navigation menu.

  3. In Monitoring, if the navigation pane isn't expanded, click Expand . This button is located on the lower left of the console.

  4. If Metrics Explorer is shown in the navigation pane, click Metrics Explorer. Otherwise, select Resources and then select Metrics Explorer.

  5. Select Redis instance as the resource type.

  6. Select Calls as the desired metric.

  7. 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. In the Google Cloud Console, select Monitoring, or use the following button:

    Go to Monitoring

  2. Select Dashboards > Create Dashboard.

  3. 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.
  4. 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. In the Google Cloud Console, select Monitoring, or use the following button:

    Go to Monitoring

  2. Select Alerting > Create a Policy.

  3. 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.
  4. Set the appropriate notification channel.

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

  6. 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. In the Google Cloud Console, select Monitoring, or use the following button:

    Go to Monitoring

  2. Select Alerting > Create a Policy.

  3. 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.
  4. Set the appropriate notification channel.

  5. Name the policy.

  6. 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 Cloud 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 Cloud Console.

    Logs Viewer

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