Monitoring Cloud SQL instances

This page describes how to monitor a Cloud SQL instance.

Cloud SQL offers two ways to monitor an instance:

  • In the Google Cloud Console
  • In Cloud Monitoring

Cloud SQL instance monitoring in the console

Cloud SQL provides some performance monitoring in the INFO PANEL on the SQL Instances page, and also in the instance overview page for a selected instance. A drop-down menu in those charts presents the following options:

  • CPU utilization
  • Storage usage
  • Memory usage
  • Read/write operations
  • Ingress/Egress bytes
  • MySQL queries
  • MySQL questions
  • Read/write InnoDB pages
  • InnoDB data fsyncs
  • InnoDB log fsyncs
  • Active connections

Additionally, a read replica offers the option Replication delay.

Console

  1. Go to the Cloud SQL Instances page in the Google Cloud Console.

    Go to the Cloud SQL Instances page

  2. Click the instance to open its Instance overview page.
  3. The metrics chart is prominent on the top of the page.

Cloud Monitoring

GCP Monitoring includes a default Cloud SQL monitoring dashboard, which includes the most commonly used metrics. You can use this dashboard to monitor the general health of your primary and replica instances. You can also create your own custom dashboards to display data that is of interest to you.

GCP Monitoring also includes many other metrics on its metrics explorer page:

Console

    To view the metrics for a monitored resource using Metrics Explorer, do the following:

    1. In the Google Cloud Console, go to Monitoring or use the following button:
      Go to Monitoring
    2. In the Monitoring navigation pane, click Metrics Explorer.
    3. Enter the monitored resource name in the Find resource type and metric text box.

    For Resource Type select Cloud SQL Database.

Replication metrics

Cloud SQL exports the replication lag metrics, as reported by the databases, as Monitoring metrics.

The replication lag is the time that the replica's state is lagging behind the primary instance. This includes writes for which the replica has already received the log, but has not yet applied the log to the database.

In addition to the default Cloud SQL dashboard, you can create a custom dashboard to monitor the replication lag for both in-region and cross-region replicas:

Console

  1. Go to the Monitoring page.
  2. Select the Dashboards tab.
  3. Click + CREATE DASHBOARD on the button bar in the top of the page.
  4. Give the dashboard a name and click OK
  5. Click ADD CHARTin the upper right-hand corner of the page.
  6. For Resource Type select Cloud SQL Database
  7. In the Select a metric field, type Replica Lag.

You can also create an alert for when the metric exceeds a given value. See more information on how to use GCP Monitoring.

What's next