Managing a database requires keeping track of its key health indicators, or "vitals," which include CPU utilization and RAM (memory) consumption. These represent the processing power and temporary working space your database instance uses. You must monitor these to ensure the database can handle its workload without slowing down or crashing, and to determine if the instance is the right size for its job.
Google Cloud's Cloud Monitoring service is the central tool for tracking these metrics. It automatically collects data using built-in agents. Important metrics to watch are the percentage of CPU Utilization, the amount of Memory Utilization (excluding disk caches), and records of security events in Cloud Logging. This data helps you establish what normal performance looks like and identify when something is wrong.
When performance is slow, you look for bottlenecks, which are points where a lack of resources limits overall speed. For example, high CPU usage or insufficient memory can cause delays. Google Cloud's Active Assist provides intelligent recommendations to help fix these issues. The Underprovisioned Instance Recommender suggests when to add more CPU or RAM, while the Overprovisioned Instance Recommender finds instances that are too large, helping you save money. Setting up alerting policies in Cloud Monitoring, like an alert for when disk space is low, helps you react to problems before they become critical.
Understanding your database's internal state relies on collecting data it generates, known as telemetry, which includes metrics, logs, and traces. Google Cloud automates this collection. Cloud Monitoring gathers resource metrics, Cloud Logging collects event logs, and Cloud Trace analyzes request flow, giving you full observability into the system's health.
A critical part of this is Cloud Audit Logs, which track "who did what, where, and when." There are four main log types. Admin Activity logs record configuration changes and are always on. Data Access logs track when data is read or modified but must be turned on manually. System Event logs are generated by Google's systems for events like restarts. To maintain security and compliance, you must regularly review these logs, using tools like the System Insights dashboard to see how system events affect performance.
Different database engines handle audit logging differently. For example, SQL Server uses audit specifications to send logs to Cloud Storage. PostgreSQL often uses the pgAudit extension to record detailed SQL commands. Investigating these logs is key for troubleshooting failures and ensuring only authorized users access data. You control who can see these logs using Identity and Access Management (IAM) roles, and you can route logs to destinations like BigQuery for analysis or Pub/Sub for real-time security monitoring.
Database performance is heavily influenced by the type of storage and how well it handles input/output (I/O) operations. Choosing the right storage is the first step. SSD storage is fast and efficient for most workloads, while HDD is better for large, infrequently accessed data that is not sensitive to delays.
To understand storage health, you monitor specific metrics. IOPS measures the number of read/write operations per second, and throughput measures how much data is transferred. High disk latency or a long queue length (waiting operations) often means the storage is struggling to keep up. You track these using Cloud Monitoring and the Ops Agent, which provide dashboards to see disk utilization and I/O performance in real time, helping you spot bottlenecks.
If your instance hits storage performance limits, you can often fix it by resizing the persistent disk. Increasing the disk's size automatically raises its IOPS and throughput limits. Sometimes, upgrading the machine type to have more vCPUs is also necessary, as the overall instance can limit total disk performance. Managing capacity is also done through automated scaling features that increase storage when needed and by using Active Assist recommendations to right-size your resources, balancing cost and performance.
Fascinated by the world of cloud databases? Explore the methods for structuring, scaling, and securing database solutions on Google Cloud as you gear up for the Professional Cloud Database Engineer exam!
Prepare and test your skills
Prepare and test your skills
Admin Activity logs record configuration changes and are always on by default. In contrast, Data Access logs track when data is read or modified and must be enabled manually.
Increasing the size of a persistent disk automatically raises its IOPS and throughput limits. Upgrading the machine type to include more vCPUs may also be necessary if the instance itself is limiting overall disk performance.
Active Assist provides the Underprovisioned Instance Recommender to suggest adding CPU or RAM when resources cause bottlenecks, while the Overprovisioned Instance Recommender identifies instances that are too large to help reduce costs. These recommendations help right-size resources to balance cost and performance.